Loading core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.Context; import android.content.Intent; import android.content.Intent; import android.content.pm.IPackageManager; import android.content.pm.IPackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo; import android.os.AsyncTask; import android.os.UserHandle; import android.os.UserHandle; import android.os.UserManager; import android.os.UserManager; import android.stats.devicepolicy.DevicePolicyEnums; import android.stats.devicepolicy.DevicePolicyEnums; Loading Loading @@ -90,7 +91,9 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { @Override @Override public void requestQuietModeEnabled(boolean enabled, UserHandle workProfileUserHandle) { public void requestQuietModeEnabled(boolean enabled, UserHandle workProfileUserHandle) { AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> { userManager.requestQuietModeEnabled(enabled, workProfileUserHandle); userManager.requestQuietModeEnabled(enabled, workProfileUserHandle); }); mIsWaitingToEnableWorkProfile = true; mIsWaitingToEnableWorkProfile = true; } } }; }; Loading Loading @@ -284,7 +287,7 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { } } private int userHandleToPageIndex(UserHandle userHandle) { private int userHandleToPageIndex(UserHandle userHandle) { if (userHandle == getPersonalListAdapter().mResolverListController.getUserHandle()) { if (userHandle.equals(getPersonalListAdapter().mResolverListController.getUserHandle())) { return PROFILE_PERSONAL; return PROFILE_PERSONAL; } else { } else { return PROFILE_WORK; return PROFILE_WORK; Loading @@ -293,7 +296,7 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { private boolean rebuildTab(ResolverListAdapter activeListAdapter, boolean doPostProcessing) { private boolean rebuildTab(ResolverListAdapter activeListAdapter, boolean doPostProcessing) { UserHandle listUserHandle = activeListAdapter.getUserHandle(); UserHandle listUserHandle = activeListAdapter.getUserHandle(); if (listUserHandle == mWorkProfileUserHandle if (listUserHandle.equals(mWorkProfileUserHandle) && mInjector.isQuietModeEnabled(mWorkProfileUserHandle)) { && mInjector.isQuietModeEnabled(mWorkProfileUserHandle)) { DevicePolicyEventLogger DevicePolicyEventLogger .createEvent(DevicePolicyEnums.RESOLVER_EMPTY_STATE_WORK_APPS_DISABLED) .createEvent(DevicePolicyEnums.RESOLVER_EMPTY_STATE_WORK_APPS_DISABLED) Loading @@ -311,7 +314,7 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { if (UserHandle.myUserId() != listUserHandle.getIdentifier()) { if (UserHandle.myUserId() != listUserHandle.getIdentifier()) { if (!mInjector.hasCrossProfileIntents(activeListAdapter.getIntents(), if (!mInjector.hasCrossProfileIntents(activeListAdapter.getIntents(), UserHandle.myUserId(), listUserHandle.getIdentifier())) { UserHandle.myUserId(), listUserHandle.getIdentifier())) { if (listUserHandle == mPersonalProfileUserHandle) { if (listUserHandle.equals(mPersonalProfileUserHandle)) { DevicePolicyEventLogger.createEvent( DevicePolicyEventLogger.createEvent( DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_SHARING_TO_PERSONAL) DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_SHARING_TO_PERSONAL) .setStrings(getMetricsCategory()) .setStrings(getMetricsCategory()) Loading core/java/com/android/internal/app/ChooserActivity.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -2140,7 +2140,7 @@ public class ChooserActivity extends ResolverActivity implements return null; return null; } } if (getPersonalProfileUserHandle() == userHandle) { if (getPersonalProfileUserHandle().equals(userHandle)) { if (mPersonalAppPredictor != null) { if (mPersonalAppPredictor != null) { return mPersonalAppPredictor; return mPersonalAppPredictor; } } Loading @@ -2166,7 +2166,7 @@ public class ChooserActivity extends ResolverActivity implements .getSystemService(AppPredictionManager.class); .getSystemService(AppPredictionManager.class); AppPredictor appPredictionSession = appPredictionManager.createAppPredictionSession( AppPredictor appPredictionSession = appPredictionManager.createAppPredictionSession( appPredictionContext); appPredictionContext); if (getPersonalProfileUserHandle() == userHandle) { if (getPersonalProfileUserHandle().equals(userHandle)) { mPersonalAppPredictor = appPredictionSession; mPersonalAppPredictor = appPredictionSession; } else { } else { mWorkAppPredictor = appPredictionSession; mWorkAppPredictor = appPredictionSession; Loading Loading @@ -2566,7 +2566,7 @@ public class ChooserActivity extends ResolverActivity implements ChooserListAdapter chooserListAdapter = (ChooserListAdapter) listAdapter; ChooserListAdapter chooserListAdapter = (ChooserListAdapter) listAdapter; if (chooserListAdapter.getUserHandle() if (chooserListAdapter.getUserHandle() == mChooserMultiProfilePagerAdapter.getCurrentUserHandle()) { .equals(mChooserMultiProfilePagerAdapter.getCurrentUserHandle())) { mChooserMultiProfilePagerAdapter.getActiveAdapterView() mChooserMultiProfilePagerAdapter.getActiveAdapterView() .setAdapter(mChooserMultiProfilePagerAdapter.getCurrentRootAdapter()); .setAdapter(mChooserMultiProfilePagerAdapter.getCurrentRootAdapter()); mChooserMultiProfilePagerAdapter mChooserMultiProfilePagerAdapter Loading core/java/com/android/internal/app/ChooserMultiProfilePagerAdapter.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -93,10 +93,10 @@ public class ChooserMultiProfilePagerAdapter extends AbstractMultiProfilePagerAd @Override @Override @Nullable @Nullable ChooserListAdapter getListAdapterForUserHandle(UserHandle userHandle) { ChooserListAdapter getListAdapterForUserHandle(UserHandle userHandle) { if (getActiveListAdapter().getUserHandle() == userHandle) { if (getActiveListAdapter().getUserHandle().equals(userHandle)) { return getActiveListAdapter(); return getActiveListAdapter(); } else if (getInactiveListAdapter() != null } else if (getInactiveListAdapter() != null && getInactiveListAdapter().getUserHandle() == userHandle) { && getInactiveListAdapter().getUserHandle().equals(userHandle)) { return getInactiveListAdapter(); return getInactiveListAdapter(); } } return null; return null; Loading core/java/com/android/internal/app/ResolverActivity.java +6 −5 Original line number Original line Diff line number Diff line Loading @@ -1242,12 +1242,12 @@ public class ResolverActivity extends Activity implements } } private void maybeLogCrossProfileTargetLaunch(TargetInfo cti, UserHandle currentUserHandle) { private void maybeLogCrossProfileTargetLaunch(TargetInfo cti, UserHandle currentUserHandle) { if (!hasWorkProfile() || currentUserHandle == getUser()) { if (!hasWorkProfile() || currentUserHandle.equals(getUser())) { return; return; } } DevicePolicyEventLogger DevicePolicyEventLogger .createEvent(DevicePolicyEnums.RESOLVER_CROSS_PROFILE_TARGET_OPENED) .createEvent(DevicePolicyEnums.RESOLVER_CROSS_PROFILE_TARGET_OPENED) .setBoolean(currentUserHandle == getPersonalProfileUserHandle()) .setBoolean(currentUserHandle.equals(getPersonalProfileUserHandle())) .setStrings(getMetricsCategory(), .setStrings(getMetricsCategory(), cti instanceof ChooserTargetInfo ? "direct_share" : "other_target") cti instanceof ChooserTargetInfo ? "direct_share" : "other_target") .write(); .write(); Loading Loading @@ -1486,7 +1486,8 @@ public class ResolverActivity extends Activity implements DevicePolicyEventLogger DevicePolicyEventLogger .createEvent(DevicePolicyEnums.RESOLVER_AUTOLAUNCH_CROSS_PROFILE_TARGET) .createEvent(DevicePolicyEnums.RESOLVER_AUTOLAUNCH_CROSS_PROFILE_TARGET) .setBoolean(activeListAdapter.getUserHandle() == getPersonalProfileUserHandle()) .setBoolean(activeListAdapter.getUserHandle() .equals(getPersonalProfileUserHandle())) .setStrings(getMetricsCategory()) .setStrings(getMetricsCategory()) .write(); .write(); safelyStartActivity(activeProfileTarget); safelyStartActivity(activeProfileTarget); Loading Loading @@ -1778,7 +1779,7 @@ public class ResolverActivity extends Activity implements @Override // ResolverListCommunicator @Override // ResolverListCommunicator public void onHandlePackagesChanged(ResolverListAdapter listAdapter) { public void onHandlePackagesChanged(ResolverListAdapter listAdapter) { if (listAdapter == mMultiProfilePagerAdapter.getActiveListAdapter()) { if (listAdapter == mMultiProfilePagerAdapter.getActiveListAdapter()) { if (listAdapter.getUserHandle() == getWorkProfileUserHandle() if (listAdapter.getUserHandle().equals(getWorkProfileUserHandle()) && mMultiProfilePagerAdapter.isWaitingToEnableWorkProfile()) { && mMultiProfilePagerAdapter.isWaitingToEnableWorkProfile()) { // We have just turned on the work profile and entered the pass code to start it, // We have just turned on the work profile and entered the pass code to start it, // now we are waiting to receive the ACTION_USER_UNLOCKED broadcast. There is no // now we are waiting to receive the ACTION_USER_UNLOCKED broadcast. There is no Loading Loading @@ -1819,7 +1820,7 @@ public class ResolverActivity extends Activity implements mMultiProfilePagerAdapter.markWorkProfileEnabledBroadcastReceived(); mMultiProfilePagerAdapter.markWorkProfileEnabledBroadcastReceived(); } } if (mMultiProfilePagerAdapter.getCurrentUserHandle() if (mMultiProfilePagerAdapter.getCurrentUserHandle() == getWorkProfileUserHandle()) { .equals(getWorkProfileUserHandle())) { mMultiProfilePagerAdapter.rebuildActiveTab(true); mMultiProfilePagerAdapter.rebuildActiveTab(true); } else { } else { mMultiProfilePagerAdapter.clearInactiveProfileCache(); mMultiProfilePagerAdapter.clearInactiveProfileCache(); Loading core/java/com/android/internal/app/ResolverMultiProfilePagerAdapter.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -103,10 +103,10 @@ public class ResolverMultiProfilePagerAdapter extends AbstractMultiProfilePagerA @Override @Override @Nullable @Nullable ResolverListAdapter getListAdapterForUserHandle(UserHandle userHandle) { ResolverListAdapter getListAdapterForUserHandle(UserHandle userHandle) { if (getActiveListAdapter().getUserHandle() == userHandle) { if (getActiveListAdapter().getUserHandle().equals(userHandle)) { return getActiveListAdapter(); return getActiveListAdapter(); } else if (getInactiveListAdapter() != null } else if (getInactiveListAdapter() != null && getInactiveListAdapter().getUserHandle() == userHandle) { && getInactiveListAdapter().getUserHandle().equals(userHandle)) { return getInactiveListAdapter(); return getInactiveListAdapter(); } } return null; return null; Loading Loading
core/java/com/android/internal/app/AbstractMultiProfilePagerAdapter.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.content.Context; import android.content.Intent; import android.content.Intent; import android.content.pm.IPackageManager; import android.content.pm.IPackageManager; import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo; import android.os.AsyncTask; import android.os.UserHandle; import android.os.UserHandle; import android.os.UserManager; import android.os.UserManager; import android.stats.devicepolicy.DevicePolicyEnums; import android.stats.devicepolicy.DevicePolicyEnums; Loading Loading @@ -90,7 +91,9 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { @Override @Override public void requestQuietModeEnabled(boolean enabled, UserHandle workProfileUserHandle) { public void requestQuietModeEnabled(boolean enabled, UserHandle workProfileUserHandle) { AsyncTask.THREAD_POOL_EXECUTOR.execute(() -> { userManager.requestQuietModeEnabled(enabled, workProfileUserHandle); userManager.requestQuietModeEnabled(enabled, workProfileUserHandle); }); mIsWaitingToEnableWorkProfile = true; mIsWaitingToEnableWorkProfile = true; } } }; }; Loading Loading @@ -284,7 +287,7 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { } } private int userHandleToPageIndex(UserHandle userHandle) { private int userHandleToPageIndex(UserHandle userHandle) { if (userHandle == getPersonalListAdapter().mResolverListController.getUserHandle()) { if (userHandle.equals(getPersonalListAdapter().mResolverListController.getUserHandle())) { return PROFILE_PERSONAL; return PROFILE_PERSONAL; } else { } else { return PROFILE_WORK; return PROFILE_WORK; Loading @@ -293,7 +296,7 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { private boolean rebuildTab(ResolverListAdapter activeListAdapter, boolean doPostProcessing) { private boolean rebuildTab(ResolverListAdapter activeListAdapter, boolean doPostProcessing) { UserHandle listUserHandle = activeListAdapter.getUserHandle(); UserHandle listUserHandle = activeListAdapter.getUserHandle(); if (listUserHandle == mWorkProfileUserHandle if (listUserHandle.equals(mWorkProfileUserHandle) && mInjector.isQuietModeEnabled(mWorkProfileUserHandle)) { && mInjector.isQuietModeEnabled(mWorkProfileUserHandle)) { DevicePolicyEventLogger DevicePolicyEventLogger .createEvent(DevicePolicyEnums.RESOLVER_EMPTY_STATE_WORK_APPS_DISABLED) .createEvent(DevicePolicyEnums.RESOLVER_EMPTY_STATE_WORK_APPS_DISABLED) Loading @@ -311,7 +314,7 @@ public abstract class AbstractMultiProfilePagerAdapter extends PagerAdapter { if (UserHandle.myUserId() != listUserHandle.getIdentifier()) { if (UserHandle.myUserId() != listUserHandle.getIdentifier()) { if (!mInjector.hasCrossProfileIntents(activeListAdapter.getIntents(), if (!mInjector.hasCrossProfileIntents(activeListAdapter.getIntents(), UserHandle.myUserId(), listUserHandle.getIdentifier())) { UserHandle.myUserId(), listUserHandle.getIdentifier())) { if (listUserHandle == mPersonalProfileUserHandle) { if (listUserHandle.equals(mPersonalProfileUserHandle)) { DevicePolicyEventLogger.createEvent( DevicePolicyEventLogger.createEvent( DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_SHARING_TO_PERSONAL) DevicePolicyEnums.RESOLVER_EMPTY_STATE_NO_SHARING_TO_PERSONAL) .setStrings(getMetricsCategory()) .setStrings(getMetricsCategory()) Loading
core/java/com/android/internal/app/ChooserActivity.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -2140,7 +2140,7 @@ public class ChooserActivity extends ResolverActivity implements return null; return null; } } if (getPersonalProfileUserHandle() == userHandle) { if (getPersonalProfileUserHandle().equals(userHandle)) { if (mPersonalAppPredictor != null) { if (mPersonalAppPredictor != null) { return mPersonalAppPredictor; return mPersonalAppPredictor; } } Loading @@ -2166,7 +2166,7 @@ public class ChooserActivity extends ResolverActivity implements .getSystemService(AppPredictionManager.class); .getSystemService(AppPredictionManager.class); AppPredictor appPredictionSession = appPredictionManager.createAppPredictionSession( AppPredictor appPredictionSession = appPredictionManager.createAppPredictionSession( appPredictionContext); appPredictionContext); if (getPersonalProfileUserHandle() == userHandle) { if (getPersonalProfileUserHandle().equals(userHandle)) { mPersonalAppPredictor = appPredictionSession; mPersonalAppPredictor = appPredictionSession; } else { } else { mWorkAppPredictor = appPredictionSession; mWorkAppPredictor = appPredictionSession; Loading Loading @@ -2566,7 +2566,7 @@ public class ChooserActivity extends ResolverActivity implements ChooserListAdapter chooserListAdapter = (ChooserListAdapter) listAdapter; ChooserListAdapter chooserListAdapter = (ChooserListAdapter) listAdapter; if (chooserListAdapter.getUserHandle() if (chooserListAdapter.getUserHandle() == mChooserMultiProfilePagerAdapter.getCurrentUserHandle()) { .equals(mChooserMultiProfilePagerAdapter.getCurrentUserHandle())) { mChooserMultiProfilePagerAdapter.getActiveAdapterView() mChooserMultiProfilePagerAdapter.getActiveAdapterView() .setAdapter(mChooserMultiProfilePagerAdapter.getCurrentRootAdapter()); .setAdapter(mChooserMultiProfilePagerAdapter.getCurrentRootAdapter()); mChooserMultiProfilePagerAdapter mChooserMultiProfilePagerAdapter Loading
core/java/com/android/internal/app/ChooserMultiProfilePagerAdapter.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -93,10 +93,10 @@ public class ChooserMultiProfilePagerAdapter extends AbstractMultiProfilePagerAd @Override @Override @Nullable @Nullable ChooserListAdapter getListAdapterForUserHandle(UserHandle userHandle) { ChooserListAdapter getListAdapterForUserHandle(UserHandle userHandle) { if (getActiveListAdapter().getUserHandle() == userHandle) { if (getActiveListAdapter().getUserHandle().equals(userHandle)) { return getActiveListAdapter(); return getActiveListAdapter(); } else if (getInactiveListAdapter() != null } else if (getInactiveListAdapter() != null && getInactiveListAdapter().getUserHandle() == userHandle) { && getInactiveListAdapter().getUserHandle().equals(userHandle)) { return getInactiveListAdapter(); return getInactiveListAdapter(); } } return null; return null; Loading
core/java/com/android/internal/app/ResolverActivity.java +6 −5 Original line number Original line Diff line number Diff line Loading @@ -1242,12 +1242,12 @@ public class ResolverActivity extends Activity implements } } private void maybeLogCrossProfileTargetLaunch(TargetInfo cti, UserHandle currentUserHandle) { private void maybeLogCrossProfileTargetLaunch(TargetInfo cti, UserHandle currentUserHandle) { if (!hasWorkProfile() || currentUserHandle == getUser()) { if (!hasWorkProfile() || currentUserHandle.equals(getUser())) { return; return; } } DevicePolicyEventLogger DevicePolicyEventLogger .createEvent(DevicePolicyEnums.RESOLVER_CROSS_PROFILE_TARGET_OPENED) .createEvent(DevicePolicyEnums.RESOLVER_CROSS_PROFILE_TARGET_OPENED) .setBoolean(currentUserHandle == getPersonalProfileUserHandle()) .setBoolean(currentUserHandle.equals(getPersonalProfileUserHandle())) .setStrings(getMetricsCategory(), .setStrings(getMetricsCategory(), cti instanceof ChooserTargetInfo ? "direct_share" : "other_target") cti instanceof ChooserTargetInfo ? "direct_share" : "other_target") .write(); .write(); Loading Loading @@ -1486,7 +1486,8 @@ public class ResolverActivity extends Activity implements DevicePolicyEventLogger DevicePolicyEventLogger .createEvent(DevicePolicyEnums.RESOLVER_AUTOLAUNCH_CROSS_PROFILE_TARGET) .createEvent(DevicePolicyEnums.RESOLVER_AUTOLAUNCH_CROSS_PROFILE_TARGET) .setBoolean(activeListAdapter.getUserHandle() == getPersonalProfileUserHandle()) .setBoolean(activeListAdapter.getUserHandle() .equals(getPersonalProfileUserHandle())) .setStrings(getMetricsCategory()) .setStrings(getMetricsCategory()) .write(); .write(); safelyStartActivity(activeProfileTarget); safelyStartActivity(activeProfileTarget); Loading Loading @@ -1778,7 +1779,7 @@ public class ResolverActivity extends Activity implements @Override // ResolverListCommunicator @Override // ResolverListCommunicator public void onHandlePackagesChanged(ResolverListAdapter listAdapter) { public void onHandlePackagesChanged(ResolverListAdapter listAdapter) { if (listAdapter == mMultiProfilePagerAdapter.getActiveListAdapter()) { if (listAdapter == mMultiProfilePagerAdapter.getActiveListAdapter()) { if (listAdapter.getUserHandle() == getWorkProfileUserHandle() if (listAdapter.getUserHandle().equals(getWorkProfileUserHandle()) && mMultiProfilePagerAdapter.isWaitingToEnableWorkProfile()) { && mMultiProfilePagerAdapter.isWaitingToEnableWorkProfile()) { // We have just turned on the work profile and entered the pass code to start it, // We have just turned on the work profile and entered the pass code to start it, // now we are waiting to receive the ACTION_USER_UNLOCKED broadcast. There is no // now we are waiting to receive the ACTION_USER_UNLOCKED broadcast. There is no Loading Loading @@ -1819,7 +1820,7 @@ public class ResolverActivity extends Activity implements mMultiProfilePagerAdapter.markWorkProfileEnabledBroadcastReceived(); mMultiProfilePagerAdapter.markWorkProfileEnabledBroadcastReceived(); } } if (mMultiProfilePagerAdapter.getCurrentUserHandle() if (mMultiProfilePagerAdapter.getCurrentUserHandle() == getWorkProfileUserHandle()) { .equals(getWorkProfileUserHandle())) { mMultiProfilePagerAdapter.rebuildActiveTab(true); mMultiProfilePagerAdapter.rebuildActiveTab(true); } else { } else { mMultiProfilePagerAdapter.clearInactiveProfileCache(); mMultiProfilePagerAdapter.clearInactiveProfileCache(); Loading
core/java/com/android/internal/app/ResolverMultiProfilePagerAdapter.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -103,10 +103,10 @@ public class ResolverMultiProfilePagerAdapter extends AbstractMultiProfilePagerA @Override @Override @Nullable @Nullable ResolverListAdapter getListAdapterForUserHandle(UserHandle userHandle) { ResolverListAdapter getListAdapterForUserHandle(UserHandle userHandle) { if (getActiveListAdapter().getUserHandle() == userHandle) { if (getActiveListAdapter().getUserHandle().equals(userHandle)) { return getActiveListAdapter(); return getActiveListAdapter(); } else if (getInactiveListAdapter() != null } else if (getInactiveListAdapter() != null && getInactiveListAdapter().getUserHandle() == userHandle) { && getInactiveListAdapter().getUserHandle().equals(userHandle)) { return getInactiveListAdapter(); return getInactiveListAdapter(); } } return null; return null; Loading