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

Commit 349da344 authored by Chen Xu's avatar Chen Xu Committed by android-build-merger
Browse files

Merge "use @SystemAPI in PackageManager"

am: 729a8293

Change-Id: I1f9e5571b4cdea6419fc148c2dd2253af7d028cd
parents 7e114062 729a8293
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1343,7 +1343,8 @@ public abstract class SMSDispatcher extends Handler {
    private CharSequence getAppLabel(String appPackage, @UserIdInt int userId) {
        PackageManager pm = mContext.getPackageManager();
        try {
            ApplicationInfo appInfo = pm.getApplicationInfoAsUser(appPackage, 0, userId);
            ApplicationInfo appInfo = pm.getApplicationInfoAsUser(appPackage, 0,
                UserHandle.getUserHandleForUid(userId));
            return appInfo.loadSafeLabel(pm, PackageItemInfo.DEFAULT_MAX_LABEL_SIZE_PX,
                    PackageItemInfo.SAFE_LABEL_FLAG_TRIM
                            | PackageItemInfo.SAFE_LABEL_FLAG_FIRST_LINE);
+1 −1
Original line number Diff line number Diff line
@@ -1349,7 +1349,7 @@ public class ImsResolver implements ImsServiceController.ImsServiceControllerCal
        for (ResolveInfo entry : packageManager.queryIntentServicesAsUser(
                serviceIntent,
                PackageManager.GET_META_DATA,
                mContext.getUserId())) {
                UserHandle.getUserHandleForUid(mContext.getUserId()))) {
            ServiceInfo serviceInfo = entry.serviceInfo;

            if (serviceInfo != null) {
+1 −1
Original line number Diff line number Diff line
@@ -597,7 +597,7 @@ public class ContextFixture implements TestFixture<Context> {
                        (Intent) invocation.getArguments()[0],
                        (Integer) invocation.getArguments()[1]);
            }
        }).when(mPackageManager).queryIntentServicesAsUser((Intent) any(), anyInt(), anyInt());
        }).when(mPackageManager).queryIntentServicesAsUser((Intent) any(), anyInt(), any());

        try {
            doReturn(mPackageInfo).when(mPackageManager).getPackageInfoAsUser(any(), anyInt(),
+3 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doThrow;
@@ -411,8 +412,8 @@ public class TelephonyPermissionsTest {
        // regardless of if the package satisfies the previous requirements for device ID access.
        mMockApplicationInfo.targetSdkVersion = Build.VERSION_CODES.Q;
        when(mMockContext.getPackageManager()).thenReturn(mMockPackageManager);
        when(mMockPackageManager.getApplicationInfoAsUser(eq(PACKAGE), anyInt(),
                anyInt())).thenReturn(mMockApplicationInfo);
        when(mMockPackageManager.getApplicationInfoAsUser(eq(PACKAGE), anyInt(), any()))
            .thenReturn(mMockApplicationInfo);

        when(mMockContext.checkCallingOrSelfPermission(
                android.Manifest.permission.READ_DEVICE_CONFIG)).thenReturn(
+1 −1
Original line number Diff line number Diff line
@@ -676,7 +676,7 @@ public abstract class TelephonyTest {
        // regardless of if the package satisfies the previous requirements for device ID access.
        mApplicationInfo.targetSdkVersion = Build.VERSION_CODES.Q;
        doReturn(mApplicationInfo).when(mPackageManager).getApplicationInfoAsUser(eq(TAG), anyInt(),
                anyInt());
                any());

        // TelephonyPermissions queries DeviceConfig to determine if the identifier access
        // restrictions should be enabled; this results in a NPE when DeviceConfig uses
Loading