Add handling for tiles with intent-action metadata.
If intent action is provided in the metadata for the dynamic tiles, it will be added to the launching intent when user selects the tile. Fixes: 31801423 Test: make RunSettingsRoboTests Change-Id: Ic3e583a578660f4d9c40feff1418e5e354ab8f60
This commit is contained in:
@@ -43,6 +43,8 @@ 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";
|
||||
|
||||
|
||||
protected final Context mContext;
|
||||
|
||||
@@ -133,13 +135,18 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
||||
}
|
||||
final Bundle metadata = tile.metaData;
|
||||
String clsName = null;
|
||||
String action = null;
|
||||
if (metadata != null) {
|
||||
clsName = metadata.getString(SettingsActivity.META_DATA_KEY_FRAGMENT_CLASS);
|
||||
action = metadata.getString(META_DATA_KEY_INTENT_ACTION);
|
||||
}
|
||||
if (!TextUtils.isEmpty(clsName)) {
|
||||
pref.setFragment(clsName);
|
||||
} else if (tile.intent != null) {
|
||||
final Intent intent = new Intent(tile.intent);
|
||||
if (action != null) {
|
||||
intent.setAction(action);
|
||||
}
|
||||
pref.setOnPreferenceClickListener(preference -> {
|
||||
ProfileSelectDialog.updateUserHandlesIfNeeded(mContext, tile);
|
||||
if (tile.userHandle == null) {
|
||||
|
Reference in New Issue
Block a user