aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/cyanogenmod/app
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2015-09-05 14:25:07 -0700
committerRaj Yengisetty <rajesh@cyngn.com>2015-09-08 17:28:20 -0700
commiteabd57572113efd495df052a3694442d0915f313 (patch)
treeb0dd6f7e3c28a4fd4c31beff4ee4ab5d623e8b0c /src/java/cyanogenmod/app
parenta458122384e38b638eae10f9f670b7f5345521b8 (diff)
downloadvendor_cmsdk-eabd57572113efd495df052a3694442d0915f313.zip
vendor_cmsdk-eabd57572113efd495df052a3694442d0915f313.tar.gz
vendor_cmsdk-eabd57572113efd495df052a3694442d0915f313.tar.bz2
Add Broadcast action and query API for AudioSource.HOTWORD.
- Add ACTION_HOTWORD_INPUT_CHANGED broadcast action and related extras. - Add getCurrentHotwordPackageName() API to SettingsManager to query the current package name of the application that controls the HOTWORD input. - Rename SettingsManager to PartnerInterface. Change-Id: I5987499cd32908c47a7e8e95d644c483dc32914c
Diffstat (limited to 'src/java/cyanogenmod/app')
-rw-r--r--src/java/cyanogenmod/app/CMContextConstants.java6
-rw-r--r--src/java/cyanogenmod/app/IPartnerInterface.aidl (renamed from src/java/cyanogenmod/app/ISettingsManager.aidl)3
-rw-r--r--src/java/cyanogenmod/app/PartnerInterface.java (renamed from src/java/cyanogenmod/app/SettingsManager.java)57
3 files changed, 42 insertions, 24 deletions
diff --git a/src/java/cyanogenmod/app/CMContextConstants.java b/src/java/cyanogenmod/app/CMContextConstants.java
index b79063a..ab80b4f 100644
--- a/src/java/cyanogenmod/app/CMContextConstants.java
+++ b/src/java/cyanogenmod/app/CMContextConstants.java
@@ -53,14 +53,14 @@ public final class CMContextConstants {
/**
* Use with {@link android.content.Context#getSystemService} to retrieve a
- * {@link cyanogenmod.app.SettingsManager} changing system settings.
+ * {@link cyanogenmod.app.PartnerInterface} interact with system settings.
*
* @see android.content.Context#getSystemService
- * @see cyanogenmod.app.SettingsManager
+ * @see cyanogenmod.app.PartnerInterface
*
* @hide
*/
- public static final String CM_SETTINGS_SERVICE = "cmsettings";
+ public static final String CM_PARTNER_INTERFACE = "cmpartnerinterface";
/**
* Use with {@link android.content.Context#getSystemService} to retrieve a
diff --git a/src/java/cyanogenmod/app/ISettingsManager.aidl b/src/java/cyanogenmod/app/IPartnerInterface.aidl
index 86fa36c..b7baa4d 100644
--- a/src/java/cyanogenmod/app/ISettingsManager.aidl
+++ b/src/java/cyanogenmod/app/IPartnerInterface.aidl
@@ -18,11 +18,12 @@
package cyanogenmod.app;
/** {@hide} */
-interface ISettingsManager
+interface IPartnerInterface
{
void setAirplaneModeEnabled(boolean enabled);
void setMobileDataEnabled(boolean enabled);
boolean setZenMode(int mode);
void shutdown();
void reboot();
+ String getCurrentHotwordPackageName();
}
diff --git a/src/java/cyanogenmod/app/SettingsManager.java b/src/java/cyanogenmod/app/PartnerInterface.java
index b8a5802..74f230a 100644
--- a/src/java/cyanogenmod/app/SettingsManager.java
+++ b/src/java/cyanogenmod/app/PartnerInterface.java
@@ -24,10 +24,10 @@ import android.util.Log;
/**
* <p>
- * The SettingsManager allows applications to modify a subset of system settings.
+ * The PartnerInterface allows applications to interact with a subset of system settings.
* </p>
*/
-public class SettingsManager {
+public class PartnerInterface {
/**
* Turn off zen mode. This restores the original ring and interruption
* settings that the user had set before zen mode was enabled.
@@ -53,7 +53,7 @@ public class SettingsManager {
*/
public static final int ZEN_MODE_NO_INTERRUPTIONS = 2;
- private static ISettingsManager sService;
+ private static IPartnerInterface sService;
private Context mContext;
@@ -70,11 +70,11 @@ public class SettingsManager {
public static final String MODIFY_SOUND_SETTINGS_PERMISSION =
"cyanogenmod.permission.MODIFY_SOUND_SETTINGS";
- private static final String TAG = "SettingsManager";
+ private static final String TAG = "PartnerInterface";
- private static SettingsManager sSettingsManagerInstance;
+ private static PartnerInterface sPartnerInterfaceInstance;
- private SettingsManager(Context context) {
+ private PartnerInterface(Context context) {
Context appContext = context.getApplicationContext();
if (appContext != null) {
mContext = appContext;
@@ -85,25 +85,25 @@ public class SettingsManager {
}
/**
- * Get or create an instance of the {@link cyanogenmod.app.SettingsManager}
+ * Get or create an instance of the {@link cyanogenmod.app.PartnerInterface}
* @param context
- * @return {@link SettingsManager}
+ * @return {@link PartnerInterface}
*/
- public static SettingsManager getInstance(Context context) {
- if (sSettingsManagerInstance == null) {
- sSettingsManagerInstance = new SettingsManager(context);
+ public static PartnerInterface getInstance(Context context) {
+ if (sPartnerInterfaceInstance == null) {
+ sPartnerInterfaceInstance = new PartnerInterface(context);
}
- return sSettingsManagerInstance;
+ return sPartnerInterfaceInstance;
}
/** @hide */
- static public ISettingsManager getService() {
+ static public IPartnerInterface getService() {
if (sService != null) {
return sService;
}
- IBinder b = ServiceManager.getService(CMContextConstants.CM_SETTINGS_SERVICE);
+ IBinder b = ServiceManager.getService(CMContextConstants.CM_PARTNER_INTERFACE);
if (b != null) {
- sService = ISettingsManager.Stub.asInterface(b);
+ sService = IPartnerInterface.Stub.asInterface(b);
return sService;
} else {
return null;
@@ -122,7 +122,7 @@ public class SettingsManager {
return;
}
try {
- getService().setAirplaneModeEnabled(enabled);
+ sService.setAirplaneModeEnabled(enabled);
} catch (RemoteException e) {
Log.e(TAG, e.getLocalizedMessage(), e);
}
@@ -140,7 +140,7 @@ public class SettingsManager {
return;
}
try {
- getService().setMobileDataEnabled(enabled);
+ sService.setMobileDataEnabled(enabled);
} catch (RemoteException e) {
Log.e(TAG, e.getLocalizedMessage(), e);
}
@@ -165,7 +165,7 @@ public class SettingsManager {
return false;
}
try {
- return getService().setZenMode(mode);
+ return sService.setZenMode(mode);
} catch (RemoteException e) {
Log.e(TAG, e.getLocalizedMessage(), e);
}
@@ -183,7 +183,7 @@ public class SettingsManager {
return;
}
try {
- getService().shutdown();
+ sService.shutdown();
} catch (RemoteException e) {
Log.e(TAG, e.getLocalizedMessage(), e);
}
@@ -200,9 +200,26 @@ public class SettingsManager {
return;
}
try {
- getService().reboot();
+ sService.reboot();
} catch (RemoteException e) {
Log.e(TAG, e.getLocalizedMessage(), e);
}
}
+
+ /**
+ * Retrieves the package name of the application that currently holds the
+ * {@link cyanogenmod.media.MediaRecorder.AudioSource#HOTWORD} input.
+ * @return The package name or null if no application currently holds the HOTWORD input.
+ */
+ public String getCurrentHotwordPackageName() {
+ if (sService == null) {
+ return null;
+ }
+ try {
+ return sService.getCurrentHotwordPackageName();
+ } catch (RemoteException e) {
+ Log.e(TAG, e.getLocalizedMessage(), e);
+ }
+ return null;
+ }
}