---
layout: post
title:  "🚀 Release: Android Components 0.24"
date:   2018-09-21 20:15:00 +0200
categories: releases
author: jonathan
---

# 0.24 (2018-09-21)

* [Commits](https://github.com/mozilla-mobile/android-components/compare/v0.23...v0.24),
[Milestone](https://github.com/mozilla-mobile/android-components/milestone/24?closed=1),
[API reference](https://mozilla-mobile.github.io/android-components/api/0.24/index)

* Compiled against:
  * Android
    * SDK: 27
    * Support Libraries: 27.1.1
  * Kotlin
    * Standard library: 1.2.61
    * Coroutines: 0.23.4
  * GeckoView
    * Nightly: 64.0.20180905100117
    * Beta: 63.0b3 (0269319281578bff4e01d77a21350bf91ba08620)
    * Release: 62.0 (9cbae12a3fff404ed2c12070ad475424d0ae869f)

* **dataprotect**: 
  * Added a component using AndroidKeyStore to protect user data.
  ```kotlin
  // Create a Keystore and generate a key
  val keystore: Keystore = Keystore("samples-dataprotect")
  keystore.generateKey()
  
  // Encrypt data
  val plainText = "plain text data".toByteArray(StandardCharsets.UTF_8)
  val encrypted = keystore.encryptBytes(plain)
  
  // Decrypt data
  val samePlainText = keystore.decryptBytes(encrypted)
  ```
* **concept-engine**: Enhanced settings to cover most common WebView settings.
* **browser-engine-system**:
  * `SystemEngineSession` now provides a way to capture a screenshot of the actual content of the web page just by calling `captureThumbnail`
* **browser-session**:
  * `Session` exposes a new property called `thumbnail` and its internal observer also exposes a new listener `onThumbnailChanged`.
    
  ```Kotlin
  session.register(object : Session.Observer {
      fun onThumbnailChanged(session: Session, bitmap: Bitmap?) {
              // Do Something
      }
  })
  ```
  
  * `SessionManager` lets you notify it when the OS is under low memory condition by calling to its new function `onLowMemory`.

* **browser-tabstray**:

   * Now on `BrowserTabsTray` every tab gets is own thumbnail :) 

* **support-ktx**:

   * Now you can easily query if the OS is under low memory conditions, just by using `isOSOnLowMemory()` extension function on `Context`.

  ```Kotlin
  val shouldReduceMemoryUsage = context.isOSOnLowMemory()
  
  if (shouldReduceMemoryUsage) {
      //Deallocate some heavy objects
  }
  ```
  
  * `View.dp` is now`Resource.pxtoDp`.

  ```Kotlin
  // Before
  toolbar.dp(104)
  
  // Now
  toolbar.resources.pxToDp(104)
  ```
* **samples-browser**:
   * Updated to show the new features related to tab thumbnails. Be aware that this feature is only available for `systemEngine` and you have to switch to the build variant `systemEngine*`.

