Search in sources :

Example 11 with UserHandle

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);
    }
}
Also used : IntentFilter(android.content.IntentFilter) UserHandle(android.os.UserHandle)

Example 12 with UserHandle

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);
}
Also used : UserHandle(android.os.UserHandle) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent)

Example 13 with UserHandle

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));
}
Also used : StatusBarNotification(android.service.notification.StatusBarNotification) UserHandle(android.os.UserHandle) Notification(android.app.Notification) StatusBarNotification(android.service.notification.StatusBarNotification)

Example 14 with UserHandle

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) {
        }
    }
}
Also used : PackageManager(android.content.pm.PackageManager) PackageInfo(android.content.pm.PackageInfo) UserHandle(android.os.UserHandle) ComponentName(android.content.ComponentName) StatusBarIcon(com.android.internal.statusbar.StatusBarIcon) StatusBarIconController(com.android.systemui.statusbar.phone.StatusBarIconController)

Example 15 with UserHandle

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);
}
Also used : UserHandle(android.os.UserHandle) Intent(android.content.Intent)

Aggregations

UserHandle (android.os.UserHandle)568 Intent (android.content.Intent)231 RemoteException (android.os.RemoteException)163 PendingIntent (android.app.PendingIntent)132 ComponentName (android.content.ComponentName)69 Context (android.content.Context)68 UserInfo (android.content.pm.UserInfo)66 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)62 Bundle (android.os.Bundle)50 IBinder (android.os.IBinder)49 UserManager (android.os.UserManager)44 PackageManager (android.content.pm.PackageManager)40 ApplicationInfo (android.content.pm.ApplicationInfo)30 IOException (java.io.IOException)30 ArrayList (java.util.ArrayList)30 ActivityNotFoundException (android.content.ActivityNotFoundException)28 Notification (android.app.Notification)27 ServiceConnection (android.content.ServiceConnection)27 IPackageManager (android.content.pm.IPackageManager)27 Pair (android.util.Pair)23