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

Commit fa984e0d authored by Heemin Seog's avatar Heemin Seog Committed by Automerger Merge Worker
Browse files

Merge "Use user context to support multiuser use case" am: fcfd6a1f am: f651b3f7

Change-Id: I2af9a2e3b866009fbe5948d509e223d175a53a70
parents cae250d3 f651b3f7
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -491,8 +491,10 @@ public class AdapterService extends Service {
        }.execute();

        try {
            int systemUiUid = getApplicationContext().getPackageManager().getPackageUid(
                    "com.android.systemui", PackageManager.MATCH_SYSTEM_ONLY);
            int systemUiUid = getApplicationContext()
                    .createContextAsUser(UserHandle.SYSTEM, /* flags= */ 0)
                    .getPackageManager()
                    .getPackageUid("com.android.systemui", PackageManager.MATCH_SYSTEM_ONLY);

            Utils.setSystemUiUid(systemUiUid);
        } catch (PackageManager.NameNotFoundException e) {
+3 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.os.Looper;
import android.os.PowerManager;
import android.os.Process;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.test.mock.MockContentResolver;
import android.util.Log;
@@ -130,6 +131,8 @@ public class AdapterServiceTest {
        when(mMockContext.getApplicationInfo()).thenReturn(mMockApplicationInfo);
        when(mMockContext.getContentResolver()).thenReturn(mMockContentResolver);
        when(mMockContext.getApplicationContext()).thenReturn(mMockContext);
        when(mMockContext.createContextAsUser(UserHandle.SYSTEM, /* flags= */ 0)).thenReturn(
                mMockContext);
        when(mMockContext.getResources()).thenReturn(mMockResources);
        when(mMockContext.getUserId()).thenReturn(Process.BLUETOOTH_UID);
        when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);