Methods Summary |
---|
public java.util.HashSet | computeComponentsRemoved(java.util.List taskKeys, java.lang.String packageName, int userId)Computes the components that have been removed as a result of a change in the specified
package.
// Identify all the tasks that should be removed as a result of the package being removed.
// Using a set to ensure that we callback once per unique component.
HashSet<ComponentName> existingComponents = new HashSet<ComponentName>();
HashSet<ComponentName> removedComponents = new HashSet<ComponentName>();
for (Task.TaskKey t : taskKeys) {
// Skip if this doesn't apply to the current user
if (t.userId != userId) continue;
ComponentName cn = t.baseIntent.getComponent();
if (cn.getPackageName().equals(packageName)) {
if (existingComponents.contains(cn)) {
// If we know that the component still exists in the package, then skip
continue;
}
if (mSystemServicesProxy.getActivityInfo(cn, userId) != null) {
existingComponents.add(cn);
} else {
removedComponents.add(cn);
}
}
}
return removedComponents;
|
public boolean | onPackageChanged(java.lang.String packageName, int uid, java.lang.String[] components)
onPackageModified(packageName);
return true;
|
public void | onPackageModified(java.lang.String packageName)
if (mCb == null) return;
// Notify callbacks that a package has changed
final int eventUserId = getChangingUserId();
mCb.onPackagesChanged(this, packageName, eventUserId);
|
public void | onPackageRemoved(java.lang.String packageName, int uid)
if (mCb == null) return;
// Notify callbacks that a package has changed
final int eventUserId = getChangingUserId();
mCb.onPackagesChanged(this, packageName, eventUserId);
|
public void | register(android.content.Context context, com.android.systemui.recents.model.RecentsPackageMonitor$PackageCallbacks cb)Registers the broadcast receivers with the specified callbacks.
mSystemServicesProxy = new SystemServicesProxy(context);
mCb = cb;
try {
// We register for events from all users, but will cross-reference them with
// packages for the current user and any profiles they have
register(context, Looper.getMainLooper(), UserHandle.ALL, true);
} catch (IllegalStateException e) {
e.printStackTrace();
}
|
public void | unregister()Unregisters the broadcast receivers.
try {
super.unregister();
} catch (IllegalStateException e) {
e.printStackTrace();
}
mSystemServicesProxy = null;
mCb = null;
|