From 8fcbd4a2fee97fb3c53a9f7a65f59ecf08311d68 Mon Sep 17 00:00:00 2001 From: Appcelerator Build Date: Thu, 8 Oct 2020 07:20:54 -0400 Subject: [PATCH] feat(android): add camera/microphone foreground service constants (#12170) Fixes TIMOB-28051 --- .../titanium/android/AndroidModule.java | 4 + apidoc/Titanium/Android/Android.yml | 162 ++++++++++++++++-- 2 files changed, 152 insertions(+), 14 deletions(-) diff --git a/android/modules/android/src/java/ti/modules/titanium/android/AndroidModule.java b/android/modules/android/src/java/ti/modules/titanium/android/AndroidModule.java index 29f89d734de..646dcdb69fd 100644 --- a/android/modules/android/src/java/ti/modules/titanium/android/AndroidModule.java +++ b/android/modules/android/src/java/ti/modules/titanium/android/AndroidModule.java @@ -541,6 +541,10 @@ public class AndroidModule extends KrollModule @Kroll.constant public static final int FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION = ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION; + @Kroll.constant + public static final int FOREGROUND_SERVICE_TYPE_MICROPHONE = ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE; + @Kroll.constant + public static final int FOREGROUND_SERVICE_TYPE_CAMERA = ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA; protected RProxy r; private LinkedList registeredBroadcastReceiverProxyList = new LinkedList<>(); diff --git a/apidoc/Titanium/Android/Android.yml b/apidoc/Titanium/Android/Android.yml index ad9797699e4..981d9ea212a 100644 --- a/apidoc/Titanium/Android/Android.yml +++ b/apidoc/Titanium/Android/Android.yml @@ -1827,65 +1827,199 @@ properties: summary: | A special value indicates to use all types set in manifest file. description: | - See [ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MANIFEST). + This constant is passed to the method. + + See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MANIFEST) + documentation for more details. type: Number permission: read-only since: "8.3.0" - name: FOREGROUND_SERVICE_TYPE_NONE - summary: | - The default foreground service type if not been set in manifest file. + summary: The default foreground service type. description: | - See [ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_NONE). + This constant is passed to the method. + + See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_NONE) + documentation for more details. type: Number permission: read-only since: "8.3.0" - name: FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK summary: | - Constant corresponding to mediaPlayback in the R.attr.foregroundServiceType attribute. Music, video, news or other media playback. + Allows music, video, news or other media playback while the app is in the background. description: | - See [ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK). + This constant is passed to the method. + + To use this constant, you must also set your `` element to the + `foregroundServieType` attribute value as shown below. + + ``` xml + + + + + + + + ``` + + See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK) + documentation for more details. type: Number permission: read-only since: "8.3.0" - name: FOREGROUND_SERVICE_TYPE_PHONE_CALL summary: | - Constant corresponding to phoneCall in the R.attr.foregroundServiceType attribute. Ongoing phone call or video conference. + Allows ongoing phone call or video conferencing access while the app is in the background. description: | - See [ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_PHONE_CALL). + This constant is passed to the method. + + To use this constant, you must also set your `` element to the + `foregroundServieType` attribute value as shown below. + + ``` xml + + + + + + + + ``` + + See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_PHONE_CALL) + documentation for more details. type: Number permission: read-only since: "8.3.0" - name: FOREGROUND_SERVICE_TYPE_LOCATION summary: | - Constant corresponding to location in the R.attr.foregroundServiceType attribute. GPS, map, navigation location update. + Allows accessing location from the GPS, map, etc. while the app is in the background. description: | - See [ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_LOCATION). + This constant is passed to the method. + + To use this constant, you must also set your `` element to the + `foregroundServieType` attribute value as shown below. + + ``` xml + + + + + + + + ``` + + See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_LOCATION) + documentation for more details. type: Number permission: read-only since: "8.3.0" - name: FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE summary: | - Constant corresponding to connectedDevice in the R.attr.foregroundServiceType attribute. Auto, bluetooth, TV or other devices connection, monitoring and interaction. + Allows connecting to Android Auto, bluetooth, TV or other devices while app is in the background. description: | - See [ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE). + This constant is passed to the method. + + To use this constant, you must also set your `` element to the + `foregroundServieType` attribute value as shown below. + + ``` xml + + + + + + + + ``` + + See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE) + documentation for more details. type: Number permission: read-only since: "8.3.0" - name: FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION summary: | - Constant corresponding to mediaProjection in the R.attr.foregroundServiceType attribute. Managing a media projection session, e.g for screen recording or taking screenshots. + Allows managing a media projection session for screen recording or taking screenshots + while app is in the background. description: | - See [ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION). + This constant is passed to the method. + + To use this constant, you must also set your `` element to the + `foregroundServieType` attribute value as shown below. + + ``` xml + + + + + + + + ``` + + See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION) + documentation for more details. type: Number permission: read-only since: "8.3.0" + - name: FOREGROUND_SERVICE_TYPE_MICROPHONE + summary: Allows the microphone to be used while the app is in the background. + description: | + This constant is passed to the method. + + To use this constant, you must also set your `` element to the + `foregroundServieType` attribute value as shown below. + + ``` xml + + + + + + + + ``` + + See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MICROPHONE) + documentation for more details. + type: Number + permission: read-only + since: "9.3.0" + + - name: FOREGROUND_SERVICE_TYPE_CAMERA + summary: Allows the camera to be used while the app is in the background. + description: | + This constant is passed to the method. + + To use this constant, you must also set your `` element to the + `foregroundServieType` attribute value as shown below. + + ``` xml + + + + + + + + ``` + + See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_CAMERA) + documentation for more details. + type: Number + permission: read-only + since: "9.3.0" + - name: FLAG_AUTO_CANCEL summary: Cancel the notification when it is clicked by the user. description: |