Add current user handle to tile intent in account detail page.

- the account detail settings page is launched with the correct user
handle when there is work profile to indicate which profile the account
belongs to. When we process the dynamic tile, for the page, we should
add this info to the tile intent, so that it can be launched with the
correct profile.
- when we launch the tile intent, check whether there's user handle
specified. If so, launch the intent directly without prompting for
profile selection.

Change-Id: I91f8c666a826909006b1f53907b3441825322c10
Fixes: 119657694
Test: make RunSettingsRoboTests
This commit is contained in:
Doris Ling
2019-01-28 13:37:31 -08:00
parent 1cf1d9b643
commit 3e586a5cf2
4 changed files with 81 additions and 5 deletions

View File

@@ -16,6 +16,8 @@
package com.android.settings.dashboard;
import static android.content.Intent.EXTRA_USER;
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_ICON_URI;
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY;
import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY_URI;
@@ -29,6 +31,7 @@ import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.os.Bundle;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -239,7 +242,14 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
mMetricsFeatureProvider.logDashboardStartIntent(mContext, intent, sourceMetricCategory);
activity.startActivityForResultAsUser(intent, 0, tile.userHandle.get(0));
} else {
ProfileSelectDialog.show(activity.getSupportFragmentManager(), tile);
final UserHandle userHandle = intent.getParcelableExtra(EXTRA_USER);
if (userHandle != null && tile.userHandle.contains(userHandle)) {
mMetricsFeatureProvider.logDashboardStartIntent(
mContext, intent, sourceMetricCategory);
activity.startActivityForResultAsUser(intent, 0, userHandle);
} else {
ProfileSelectDialog.show(activity.getSupportFragmentManager(), tile);
}
}
}