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