use of android.os.UserHandle in project platform_frameworks_base by android.
the class RemoteDisplayProviderWatcher method start.
public void start() {
if (!mRunning) {
mRunning = true;
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
filter.addAction(Intent.ACTION_PACKAGE_RESTARTED);
filter.addDataScheme("package");
mContext.registerReceiverAsUser(mScanPackagesReceiver, new UserHandle(mUserId), filter, null, mHandler);
// Scan packages.
// Also has the side-effect of restarting providers if needed.
mHandler.post(mScanPackagesRunnable);
}
}
use of android.os.UserHandle in project platform_frameworks_base by android.
the class UserManagerService method sendProfileRemovedBroadcast.
private void sendProfileRemovedBroadcast(int parentUserId, int removedUserId) {
Intent managedProfileIntent = new Intent(Intent.ACTION_MANAGED_PROFILE_REMOVED);
managedProfileIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND);
managedProfileIntent.putExtra(Intent.EXTRA_USER, new UserHandle(removedUserId));
managedProfileIntent.putExtra(Intent.EXTRA_USER_HANDLE, removedUserId);
mContext.sendBroadcastAsUser(managedProfileIntent, new UserHandle(parentUserId), null);
}
use of android.os.UserHandle in project platform_frameworks_base by android.
the class RankingHelperTest method setUp.
@Override
public void setUp() {
MockitoAnnotations.initMocks(this);
UserHandle user = UserHandle.ALL;
mHelper = new RankingHelper(getContext(), handler, mUsageStats, new String[] { ImportanceExtractor.class.getName() });
mNotiGroupGSortA = new Notification.Builder(getContext()).setContentTitle("A").setGroup("G").setSortKey("A").setWhen(1205).build();
mRecordGroupGSortA = new NotificationRecord(getContext(), new StatusBarNotification("package", "package", 1, null, 0, 0, 0, mNotiGroupGSortA, user));
mNotiGroupGSortB = new Notification.Builder(getContext()).setContentTitle("B").setGroup("G").setSortKey("B").setWhen(1200).build();
mRecordGroupGSortB = new NotificationRecord(getContext(), new StatusBarNotification("package", "package", 1, null, 0, 0, 0, mNotiGroupGSortB, user));
mNotiNoGroup = new Notification.Builder(getContext()).setContentTitle("C").setWhen(1201).build();
mRecordNoGroup = new NotificationRecord(getContext(), new StatusBarNotification("package", "package", 1, null, 0, 0, 0, mNotiNoGroup, user));
mNotiNoGroup2 = new Notification.Builder(getContext()).setContentTitle("D").setWhen(1202).build();
mRecordNoGroup2 = new NotificationRecord(getContext(), new StatusBarNotification("package", "package", 1, null, 0, 0, 0, mNotiNoGroup2, user));
mNotiNoGroupSortA = new Notification.Builder(getContext()).setContentTitle("E").setWhen(1201).setSortKey("A").build();
mRecordNoGroupSortA = new NotificationRecord(getContext(), new StatusBarNotification("package", "package", 1, null, 0, 0, 0, mNotiNoGroupSortA, user));
}
use of android.os.UserHandle in project platform_frameworks_base by android.
the class TileServices method updateStatusIcon.
@Override
public void updateStatusIcon(IBinder token, Icon icon, String contentDescription) {
CustomTile customTile = getTileForToken(token);
if (customTile != null) {
verifyCaller(customTile);
try {
ComponentName componentName = customTile.getComponent();
String packageName = componentName.getPackageName();
UserHandle userHandle = getCallingUserHandle();
PackageInfo info = mContext.getPackageManager().getPackageInfoAsUser(packageName, 0, userHandle.getIdentifier());
if (info.applicationInfo.isSystemApp()) {
final StatusBarIcon statusIcon = icon != null ? new StatusBarIcon(userHandle, packageName, icon, 0, 0, contentDescription) : null;
mMainHandler.post(new Runnable() {
@Override
public void run() {
StatusBarIconController iconController = mHost.getIconController();
iconController.setIcon(componentName.getClassName(), statusIcon);
iconController.setExternalIcon(componentName.getClassName());
}
});
}
} catch (PackageManager.NameNotFoundException e) {
}
}
}
use of android.os.UserHandle in project platform_frameworks_base by android.
the class RecentsActivity method onBusEvent.
public final void onBusEvent(ShowApplicationInfoEvent event) {
// Create a new task stack with the application info details activity
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.fromParts("package", event.task.key.getComponent().getPackageName(), null));
intent.setComponent(intent.resolveActivity(getPackageManager()));
TaskStackBuilder.create(this).addNextIntentWithParentStack(intent).startActivities(null, new UserHandle(event.task.key.userId));
// Keep track of app-info invocations
MetricsLogger.count(this, "overview_app_info", 1);
}
Aggregations