Add a metadata to control whether an external intent should be opened in
the personal profile when in a managed profile. This change introduces the com.android.settings.profile metadata with possible values "primary_profile_only" and "all_profiles" (the default value when not specified). If an application declares this metadata with a value of "primary_profile_only", in a work profile the ProfileSelectDialog is never shown and the application is opened straight in the personal profile. If an application specifies a value of "all_profiles" or does not specify anything, the ProfileSelectDialog is shown to the user. Bug: 79868199 Test: atest packages/apps/Settings/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java#openTileIntent_profileSelectionDialog_shouldShow Test: atest packages/apps/Settings/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java#openTileIntent_profileSelectionDialog_explicitMetadataShouldShow Test: atest packages/apps/Settings/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java#openTileIntent_profileSelectionDialog_shouldNotShow Change-Id: Id62ab44b58b93c479407cc1bacc7a806a09bfd1b
This commit is contained in:
@@ -60,7 +60,6 @@ import androidx.preference.Preference;
|
||||
public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
||||
|
||||
private static final String TAG = "DashboardFeatureImpl";
|
||||
|
||||
private static final String DASHBOARD_TILE_PREF_KEY_PREFIX = "dashboard_tile_pref_";
|
||||
private static final String META_DATA_KEY_INTENT_ACTION = "com.android.settings.intent.action";
|
||||
@VisibleForTesting
|
||||
@@ -277,7 +276,8 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
||||
return;
|
||||
}
|
||||
ProfileSelectDialog.updateUserHandlesIfNeeded(mContext, tile);
|
||||
if (tile.userHandle == null) {
|
||||
|
||||
if (tile.userHandle == null || tile.isPrimaryProfileOnly()) {
|
||||
mMetricsFeatureProvider.logDashboardStartIntent(mContext, intent, sourceMetricCategory);
|
||||
activity.startActivityForResult(intent, 0);
|
||||
} else if (tile.userHandle.size() == 1) {
|
||||
|
Reference in New Issue
Block a user