Allow extras to be passed to app info subscreens

And pass though some extras through to notification settings.

This enables us to highlight appropriate preferences on the
subscreens while still funneling users through the app info
screen.

Test: make RunSettingsRoboTests
Bug: 72764587
Change-Id: I0197b595fe4bf3504588d9dd2985dd20de73c640
This commit is contained in:
Julia Reynolds
2018-02-12 16:47:59 -05:00
parent 49c8080a50
commit bf3e2243ef
7 changed files with 108 additions and 6 deletions

View File

@@ -16,7 +16,10 @@
package com.android.settings.applications.appinfo;
import static com.android.settings.SettingsActivity.EXTRA_FRAGMENT_ARG_KEY;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.preference.Preference;
import com.android.settings.SettingsPreferenceFragment;
@@ -27,12 +30,17 @@ import com.android.settingslib.applications.ApplicationsState;
public class AppNotificationPreferenceController extends AppInfoPreferenceControllerBase {
private static final String KEY_NOTIFICATION = "notification_settings";
private String mChannelId = null;
// Used for updating notification preference.
private final NotificationBackend mBackend = new NotificationBackend();
public AppNotificationPreferenceController(Context context, AppInfoDashboardFragment parent) {
super(context, parent, KEY_NOTIFICATION);
if (parent != null && parent.getActivity() != null
&& parent.getActivity().getIntent() != null) {
mChannelId = parent.getActivity().getIntent().getStringExtra(EXTRA_FRAGMENT_ARG_KEY);
}
}
@Override
@@ -45,6 +53,16 @@ public class AppNotificationPreferenceController extends AppInfoPreferenceContro
return AppNotificationSettings.class;
}
@Override
protected Bundle getArguments() {
Bundle bundle = null;
if (mChannelId != null) {
bundle = new Bundle();
bundle.putString(EXTRA_FRAGMENT_ARG_KEY, mChannelId);
}
return bundle;
}
private CharSequence getNotificationSummary(ApplicationsState.AppEntry appEntry,
Context context, NotificationBackend backend) {
NotificationBackend.AppRow appRow =