CMSDK: Create means of removing tiles via listener interface.

Change-Id: I8934fe5c82963a3aba38ce5eec6e59e50a820d17
This commit is contained in:
Adnan Begovic
2015-04-28 17:51:12 -07:00
parent aa8614e39b
commit aa558ade9e
3 changed files with 65 additions and 2 deletions

View File

@@ -191,4 +191,37 @@ public class CustomTileListenerService extends Service {
public void onListenerConnected() {
// optional
}
/**
* Inform the {@link cyanogenmod.app.CMStatusBarManager} about dismissal of a single custom tile.
* <p>
* Use this if your listener has a user interface that allows the user to dismiss individual
* custom tiles, similar to the behavior of Android's status bar and notification panel.
* It should be called after the user dismisses a single custom tile using your UI;
* upon being informed, the cmstatusbar manager will actually remove the custom tile
* and you will get an {@link #onCustomTileRemoved(StatusBarPanelCustomTile)} callback.
* <P>
*
* @param pkg Package of the notifying app.
* @param tag Tag of the custom tile as specified by the notifying app
* @param id ID of the notification as specified by the notifying app
* <p>
*/
public final void removeCustomTile(String pkg, String tag, int id) {
if (!isBound()) return;
try {
getStatusBarInterface().removeCustomTileFromListener(
mWrapper, pkg, tag, id);
} catch (android.os.RemoteException ex) {
Log.v(TAG, "Unable to contact cmstautusbar manager", ex);
}
}
private boolean isBound() {
if (mWrapper == null) {
Log.w(TAG, "CustomTile listener service not yet bound.");
return false;
}
return true;
}
}

View File

@@ -34,4 +34,5 @@ interface ICMStatusBarManager {
// You need the BIND_QUICK_SETTINGS_TILE_LISTENER permission
void registerListener(in ICustomTileListener listener, in ComponentName component, int userid);
void unregisterListener(in ICustomTileListener listener, int userid);
void removeCustomTileFromListener(in ICustomTileListener listener, String pkg, String tag, int id);
}