From e54a96d647b8d54a987d85bcf1be020d17fde366 Mon Sep 17 00:00:00 2001 From: Adnan Begovic Date: Thu, 30 Apr 2015 17:26:01 -0700 Subject: [PATCH] CMSDK: Update implementation for permission declarations. Change-Id: I9cca55f693ef3f0363bac2f5c8ae1db07adc4f34 --- .../internal/CMStatusBarManagerService.java | 16 +++++++-------- .../cyanogenmod/app/CMStatusBarManager.java | 20 +++++++++++++++++-- .../cyanogenmod/app/ICMStatusBarManager.aidl | 2 +- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/cm/lib/main/java/org/cyanogenmod/platform/internal/CMStatusBarManagerService.java b/cm/lib/main/java/org/cyanogenmod/platform/internal/CMStatusBarManagerService.java index b640aaf..433238a 100644 --- a/cm/lib/main/java/org/cyanogenmod/platform/internal/CMStatusBarManagerService.java +++ b/cm/lib/main/java/org/cyanogenmod/platform/internal/CMStatusBarManagerService.java @@ -337,15 +337,15 @@ public class CMStatusBarManagerService extends SystemService { } private void enforceCustomTilePublish() { - //mContext.enforceCallingOrSelfPermission( - // android.Manifest.permission.PUBLISH_QUICK_SETTINGS_TILE, - // "StatusBarManagerService"); + mContext.enforceCallingOrSelfPermission( + android.Manifest.permission.PUBLISH_CUSTOM_TILE, + "StatusBarManagerService"); } private void enforceBindCustomTileListener() { - //mContext.enforceCallingOrSelfPermission( - // android.Manifest.permission.BIND_CUSTOM_TILE_LISTENER_SERVICE, - // "StatusBarManagerService"); + mContext.enforceCallingOrSelfPermission( + android.Manifest.permission.BIND_CUSTOM_TILE_LISTENER_SERVICE, + "StatusBarManagerService"); } private boolean isVisibleToListener(StatusBarPanelCustomTile sbc, @@ -368,10 +368,10 @@ public class CMStatusBarManagerService extends SystemService { c.serviceInterface = CustomTileListenerService.SERVICE_INTERFACE; //TODO: Implement this in the future //c.secureSettingName = Settings.Secure.ENABLED_CUSTOM_TILE_LISTENERS; - //c.bindPermission = android.Manifest.permission.BIND_CUSTOM_TILE_LISTENER_SERVICE; + c.bindPermission = android.Manifest.permission.BIND_CUSTOM_TILE_LISTENER_SERVICE; //TODO: Implement this in the future //c.settingsAction = Settings.ACTION_CUSTOM_TILE_LISTENER_SETTINGS; - //c.clientLabel = R.string.custom_tile_listener_binding_label; + c.clientLabel = R.string.custom_tile_listener_binding_label; return c; } diff --git a/src/java/cyanogenmod/app/CMStatusBarManager.java b/src/java/cyanogenmod/app/CMStatusBarManager.java index 1fe6006..d5fa68f 100644 --- a/src/java/cyanogenmod/app/CMStatusBarManager.java +++ b/src/java/cyanogenmod/app/CMStatusBarManager.java @@ -84,6 +84,8 @@ public class CMStatusBarManager { * the same id has already been posted by your application and has not yet been removed, it * will be replaced by the updated information. * + * You will need the android.permission.PUBLISH_CUSTOM_TILE to utilize this functionality. + * * @param id An identifier for this customTile unique within your * application. * @param customTile A {@link CustomTile} object describing what to show the user. @@ -98,6 +100,8 @@ public class CMStatusBarManager { * the same tag and id has already been posted by your application and has not yet been * removed, it will be replaced by the updated information. * + * You will need the android.permission.PUBLISH_CUSTOM_TILE to utilize this functionality. + * * @param tag A string identifier for this custom tile. May be {@code null}. * @param id An identifier for this custom tile. The pair (tag, id) must be unique * within your application. @@ -127,6 +131,9 @@ public class CMStatusBarManager { /** * Similar to {@link cyanogenmod.app.CMStatusBarManager#publishTile(int id, cyanogenmod.app.CustomTile)}, * however lets you specify a {@link android.os.UserHandle} + * + * You will need the android.permission.PUBLISH_CUSTOM_TILE to utilize this functionality. + * * @param tag A string identifier for this custom tile. May be {@code null}. * @param id An identifier for this custom tile. The pair (tag, id) must be unique * within your application. @@ -156,6 +163,9 @@ public class CMStatusBarManager { /** * Remove a custom tile that's currently published to the StatusBarPanel. + * + * You will need the android.permission.PUBLISH_CUSTOM_TILE to utilize this functionality. + * * @param id The identifier for the custom tile to be removed. */ public void removeTile(int id) { @@ -164,6 +174,9 @@ public class CMStatusBarManager { /** * Remove a custom tile that's currently published to the StatusBarPanel. + * + * You will need the android.permission.PUBLISH_CUSTOM_TILE to utilize this functionality. + * * @param tag The string identifier for the custom tile to be removed. * @param id The identifier for the custom tile to be removed. */ @@ -183,8 +196,11 @@ public class CMStatusBarManager { } /** - * Similar to {@link cyanogenmod.app.CMStatusBarManager#removeTile(String tag, int id)} however lets you - * specific a {@link android.os.UserHandle} + * Similar to {@link cyanogenmod.app.CMStatusBarManager#removeTile(String tag, int id)} + * however lets you specific a {@link android.os.UserHandle} + * + * You will need the android.permission.PUBLISH_CUSTOM_TILE to utilize this functionality. + * * @param tag The string identifier for the custom tile to be removed. * @param id The identifier for the custom tile to be removed. * @param user The user handle to remove the tile from. diff --git a/src/java/cyanogenmod/app/ICMStatusBarManager.aidl b/src/java/cyanogenmod/app/ICMStatusBarManager.aidl index 88e28b0..62283a5 100644 --- a/src/java/cyanogenmod/app/ICMStatusBarManager.aidl +++ b/src/java/cyanogenmod/app/ICMStatusBarManager.aidl @@ -25,7 +25,7 @@ import cyanogenmod.app.ICustomTileListener; interface ICMStatusBarManager { // --- Methods below are for use by 3rd party applications to publish quick // settings tiles to the status bar panel - // You need the PUBLISH_QUICK_SETTINGS_TILE permission + // You need the PUBLISH_CUSTOM_TILE permission void createCustomTileWithTag(String pkg, String opPkg, String tag, int id, in CustomTile tile, inout int[] idReceived, int userId); void removeCustomTileWithTag(String pkg, String tag, int id, int userId);