Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5491881d authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Pass in the user defined by Context."

parents 59c490f2 ad357d18
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -183,10 +183,7 @@ package android.content {
  }

  public abstract class Context {
    method public abstract int getUserId();
  }

  public class ContextWrapper extends android.content.Context {
    method public android.os.UserHandle getUser();
    method public int getUserId();
  }

+3 −3
Original line number Diff line number Diff line
@@ -680,7 +680,7 @@ public class AccountManager {
     */
    @NonNull
    public Account[] getAccountsByType(String type) {
        return getAccountsByTypeAsUser(type, Process.myUserHandle());
        return getAccountsByTypeAsUser(type, mContext.getUser());
    }

    /** @hide Same as {@link #getAccountsByType(String)} but for a specific user. */
@@ -2006,7 +2006,7 @@ public class AccountManager {
            final AccountManagerCallback<Bundle> callback,
            final Handler handler) {
        return confirmCredentialsAsUser(account, options, activity, callback, handler,
                Process.myUserHandle());
                mContext.getUser());
    }

    /**
@@ -3208,7 +3208,7 @@ public class AccountManager {
        return finishSessionAsUser(
                sessionBundle,
                activity,
                Process.myUserHandle(),
                mContext.getUser(),
                callback,
                handler);
    }
+1 −1
Original line number Diff line number Diff line
@@ -5832,7 +5832,7 @@ public class Activity extends ContextThemeWrapper
                        ActivityManager.INTENT_SENDER_ACTIVITY_RESULT, packageName,
                        mParent == null ? mToken : mParent.mToken,
                        mEmbeddedID, requestCode, new Intent[] { data }, null, flags, null,
                        UserHandle.myUserId());
                        getUserId());
            return target != null ? new PendingIntent(target) : null;
        } catch (RemoteException e) {
            // Empty
+6 −6
Original line number Diff line number Diff line
@@ -1691,7 +1691,7 @@ public class ActivityManager {
            if (maxNum < 0) {
                throw new IllegalArgumentException("The requested number of tasks should be >= 0");
            }
            return getService().getRecentTasks(maxNum, flags, UserHandle.myUserId()).getList();
            return getService().getRecentTasks(maxNum, flags, mContext.getUserId()).getList();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -2685,7 +2685,7 @@ public class ActivityManager {
    public boolean clearApplicationUserData(String packageName, IPackageDataObserver observer) {
        try {
            return getService().clearApplicationUserData(packageName, false,
                    observer, UserHandle.myUserId());
                    observer, mContext.getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -2724,7 +2724,7 @@ public class ActivityManager {
        try {
            @SuppressWarnings("unchecked")
            final ParceledListSlice<GrantedUriPermission> castedList = getService()
                    .getGrantedUriPermissions(packageName, UserHandle.myUserId());
                    .getGrantedUriPermissions(packageName, mContext.getUserId());
            return castedList;
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
@@ -2743,7 +2743,7 @@ public class ActivityManager {
    public void clearGrantedUriPermissions(String packageName) {
        try {
            getService().clearGrantedUriPermissions(packageName,
                    UserHandle.myUserId());
                    mContext.getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -3528,7 +3528,7 @@ public class ActivityManager {
    public void killBackgroundProcesses(String packageName) {
        try {
            getService().killBackgroundProcesses(packageName,
                    UserHandle.myUserId());
                    mContext.getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -3586,7 +3586,7 @@ public class ActivityManager {
    @SystemApi
    @RequiresPermission(Manifest.permission.FORCE_STOP_PACKAGES)
    public void forceStopPackage(String packageName) {
        forceStopPackageAsUser(packageName, UserHandle.myUserId());
        forceStopPackageAsUser(packageName, mContext.getUserId());
    }

    /**
+3 −1
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@ public class AlarmManager {
    public static final int FLAG_IDLE_UNTIL = 1<<4;

    private final IAlarmManager mService;
    private final Context mContext;
    private final String mPackageName;
    private final boolean mAlwaysExact;
    private final int mTargetSdkVersion;
@@ -265,6 +266,7 @@ public class AlarmManager {
    AlarmManager(IAlarmManager service, Context ctx) {
        mService = service;

        mContext = ctx;
        mPackageName = ctx.getPackageName();
        mTargetSdkVersion = ctx.getApplicationInfo().targetSdkVersion;
        mAlwaysExact = (mTargetSdkVersion < Build.VERSION_CODES.KITKAT);
@@ -1028,7 +1030,7 @@ public class AlarmManager {
     * @see #ACTION_NEXT_ALARM_CLOCK_CHANGED
     */
    public AlarmClockInfo getNextAlarmClock() {
        return getNextAlarmClock(UserHandle.myUserId());
        return getNextAlarmClock(mContext.getUserId());
    }

    /**
Loading