CMSDK: Update implementation for permission declarations.

Change-Id: I9cca55f693ef3f0363bac2f5c8ae1db07adc4f34
This commit is contained in:
Adnan Begovic 2015-04-30 17:26:01 -07:00
parent fa69d26821
commit e54a96d647
3 changed files with 27 additions and 11 deletions

View File

@ -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;
}

View File

@ -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.

View File

@ -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);