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 Original line Diff line number Diff line
@@ -183,10 +183,7 @@ package android.content {
  }
  }


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

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


+3 −3
Original line number Original line Diff line number Diff line
@@ -680,7 +680,7 @@ public class AccountManager {
     */
     */
    @NonNull
    @NonNull
    public Account[] getAccountsByType(String type) {
    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. */
    /** @hide Same as {@link #getAccountsByType(String)} but for a specific user. */
@@ -2006,7 +2006,7 @@ public class AccountManager {
            final AccountManagerCallback<Bundle> callback,
            final AccountManagerCallback<Bundle> callback,
            final Handler handler) {
            final Handler handler) {
        return confirmCredentialsAsUser(account, options, activity, callback, handler,
        return confirmCredentialsAsUser(account, options, activity, callback, handler,
                Process.myUserHandle());
                mContext.getUser());
    }
    }


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


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


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


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


    /**
    /**
Loading