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

Commit 23699315 authored by Songchun Fan's avatar Songchun Fan
Browse files

[SettingsLib] fix test after IPackageManager flag change

ag/16288469 changed some of IPackageManager methods to use long flags
instead of int flags. That CL didn't include a fix for Settings Lib
tests. This CL fixes that.

BUG: 208469125
Test: atest com.android.settingslib.users.AppRestrictionsHelperTest
Change-Id: I0c2a7db2844baf84d382fdbdc5ce88ffe360a173
parent 30afad00
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.settingslib.users;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.argThat;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.times;
@@ -135,11 +136,11 @@ public class AppCopyingHelperTest extends BaseTest {
        ApplicationInfo info = new ApplicationInfo();
        info.privateFlags |= ApplicationInfo.PRIVATE_FLAG_HIDDEN;
        info.flags |= ApplicationInfo.FLAG_INSTALLED;
        when(mIpm.getApplicationInfo(eq("app3"), anyInt(), eq(testUserId)))
        when(mIpm.getApplicationInfo(eq("app3"), anyLong(), eq(testUserId)))
                .thenReturn(info);

        info = new ApplicationInfo();
        when(mIpm.getApplicationInfo(eq("app4"), anyInt(), eq(testUserId)))
        when(mIpm.getApplicationInfo(eq("app4"), anyLong(), eq(testUserId)))
                .thenReturn(info);

        mHelper.installSelectedApps();
+3 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.settingslib.users;

import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.argThat;
import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.nullable;
@@ -133,12 +134,12 @@ public class AppRestrictionsHelperTest extends BaseTest {
        ApplicationInfo info = new ApplicationInfo();
        info.privateFlags |= ApplicationInfo.PRIVATE_FLAG_HIDDEN;
        info.flags |= ApplicationInfo.FLAG_INSTALLED;
        when(mIpm.getApplicationInfo(eq("app2"), anyInt(), eq(testUserId)))
        when(mIpm.getApplicationInfo(eq("app2"), anyLong(), eq(testUserId)))
                .thenReturn(info);

        mHelper.setPackageSelected("app3", false);
        info = new ApplicationInfo();
        when(mIpm.getApplicationInfo(eq("app3"), anyInt(), eq(testUserId)))
        when(mIpm.getApplicationInfo(eq("app3"), anyLong(), eq(testUserId)))
                .thenReturn(info);

        AppRestrictionsHelper.OnDisableUiForPackageListener mockListener =
+2 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
@@ -203,7 +204,7 @@ public class ApplicationsStateRoboTest {
        infos.add(createApplicationInfo("test.hidden.module.2"));
        infos.add(createApplicationInfo("test.package.3"));
        when(mPackageManagerService.getInstalledApplications(
            anyInt() /* flags */, anyInt() /* userId */)).thenReturn(new ParceledListSlice(infos));
            anyLong() /* flags */, anyInt() /* userId */)).thenReturn(new ParceledListSlice(infos));

        ApplicationsState.sInstance = null;
        mApplicationsState =