Loading src/com/android/settings/applications/AppInfoBase.java +3 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment implements ApplicationsState.Callbacks { public static final String ARG_PACKAGE_NAME = "package"; public static final String ARG_PACKAGE_UID = "uid"; protected static final String TAG = AppInfoBase.class.getSimpleName(); protected static final boolean localLOGV = false; Loading Loading @@ -197,10 +198,11 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment refreshUi(); } public static void startAppInfoFragment(Class<? extends AppInfoBase> fragment, int titleRes, public static void startAppInfoFragment(Class<?> fragment, int titleRes, String pkg, int uid, Fragment source, int request) { Bundle args = new Bundle(); args.putString(AppInfoBase.ARG_PACKAGE_NAME, pkg); args.putInt(AppInfoBase.ARG_PACKAGE_UID, uid); Intent intent = Utils.onBuildStartFragmentIntent(source.getActivity(), fragment.getName(), args, null, titleRes, null, false); Loading src/com/android/settings/applications/InstalledAppDetails.java +6 −12 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import com.android.settings.fuelgauge.BatteryEntry; import com.android.settings.fuelgauge.PowerUsageDetail; import com.android.settings.net.ChartData; import com.android.settings.net.ChartDataLoader; import com.android.settings.notification.AppNotificationSettings; import com.android.settings.notification.NotificationBackend; import com.android.settings.notification.NotificationBackend.AppRow; Loading Loading @@ -626,25 +627,17 @@ public class InstalledAppDetails extends AppInfoBase } } private void startAppInfoFragment(Class<? extends AppInfoBase> fragment, CharSequence title) { private void startAppInfoFragment(Class<?> fragment, CharSequence title) { // start new fragment to display extended information Bundle args = new Bundle(); args.putString(InstalledAppDetails.ARG_PACKAGE_NAME, mAppEntry.info.packageName); args.putString(ARG_PACKAGE_NAME, mAppEntry.info.packageName); args.putInt(ARG_PACKAGE_UID, mAppEntry.info.uid); args.putBoolean(AppInfoWithHeader.EXTRA_HIDE_INFO_BUTTON, true); SettingsActivity sa = (SettingsActivity) getActivity(); sa.startPreferencePanel(fragment.getName(), args, -1, title, this, SUB_INFO_FRAGMENT); } private void startNotifications() { // start new fragment to display extended information getActivity().startActivity(new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) .putExtra(AppInfoWithHeader.EXTRA_HIDE_INFO_BUTTON, true) .putExtra(Settings.EXTRA_APP_PACKAGE, mAppEntry.info.packageName) .putExtra(Settings.EXTRA_APP_UID, mAppEntry.info.uid)); } /* * Method implementing functionality of buttons clicked * @see android.view.View.OnClickListener#onClick(android.view.View) Loading Loading @@ -680,7 +673,8 @@ public class InstalledAppDetails extends AppInfoBase if (preference == mStoragePreference) { startAppInfoFragment(AppStorageSettings.class, mStoragePreference.getTitle()); } else if (preference == mNotificationPreference) { startNotifications(); startAppInfoFragment(AppNotificationSettings.class, getString(R.string.app_notifications_title)); } else if (preference == mPermissionsPreference) { startManagePermissionsActivity(); } else if (preference == mLaunchPreference) { Loading src/com/android/settings/applications/ManageApplications.java +4 −7 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ import com.android.settings.applications.ApplicationsState.AppFilter; import com.android.settings.applications.ApplicationsState.CompoundFilter; import com.android.settings.applications.ApplicationsState.VolumeFilter; import com.android.settings.fuelgauge.HighPowerDetail; import com.android.settings.notification.AppNotificationSettings; import com.android.settings.notification.NotificationBackend; import com.android.settings.notification.NotificationBackend.AppRow; Loading Loading @@ -422,14 +423,10 @@ public class ManageApplications extends InstrumentedFragment // utility method used to start sub activity private void startApplicationDetailsActivity() { Activity activity = getActivity(); switch (mListType) { case LIST_TYPE_NOTIFICATION: activity.startActivityAsUser(new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) .putExtra(Settings.EXTRA_APP_PACKAGE, mCurrentPkgName) .putExtra(Settings.EXTRA_APP_UID, mCurrentUid), new UserHandle(UserHandle.getUserId(mCurrentUid))); startAppInfoFragment(AppNotificationSettings.class, R.string.app_notifications_title); break; case LIST_TYPE_DOMAINS_URLS: startAppInfoFragment(AppLaunchSettings.class, R.string.auto_launch_label); Loading @@ -452,7 +449,7 @@ public class ManageApplications extends InstrumentedFragment } } private void startAppInfoFragment(Class<? extends AppInfoBase> fragment, int titleRes) { private void startAppInfoFragment(Class<?> fragment, int titleRes) { AppInfoBase.startAppInfoFragment(fragment, titleRes, mCurrentPkgName, mCurrentUid, this, INSTALLED_APP_DETAILS); } Loading src/com/android/settings/notification/AppNotificationSettings.java +13 −17 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import com.android.settings.AppHeader; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; import com.android.settings.Utils; import com.android.settings.applications.AppInfoBase; import com.android.settings.applications.AppInfoWithHeader; import com.android.settings.notification.NotificationBackend.AppRow; Loading @@ -59,9 +60,6 @@ public class AppNotificationSettings extends SettingsPreferenceFragment { private static final String KEY_SENSITIVE = "sensitive"; private static final String KEY_APP_SETTINGS = "app_settings"; static final String EXTRA_HAS_SETTINGS_INTENT = "has_settings_intent"; static final String EXTRA_SETTINGS_INTENT = "settings_intent"; private static final Intent APP_NOTIFICATION_PREFS_CATEGORY_INTENT = new Intent(Intent.ACTION_MAIN) .addCategory(Notification.INTENT_CATEGORY_NOTIFICATION_PREFERENCES); Loading Loading @@ -101,15 +99,20 @@ public class AppNotificationSettings extends SettingsPreferenceFragment { super.onCreate(savedInstanceState); mContext = getActivity(); Intent intent = getActivity().getIntent(); Bundle args = getArguments(); if (DEBUG) Log.d(TAG, "onCreate getIntent()=" + intent); if (intent == null) { if (intent == null && args == null) { Log.w(TAG, "No intent"); toastAndFinish(); return; } final int uid = intent.getIntExtra(Settings.EXTRA_APP_UID, -1); final String pkg = intent.getStringExtra(Settings.EXTRA_APP_PACKAGE); final String pkg = args != null && args.containsKey(AppInfoBase.ARG_PACKAGE_NAME) ? args.getString(AppInfoBase.ARG_PACKAGE_NAME) : intent.getStringExtra(Settings.EXTRA_APP_PACKAGE); final int uid = args != null && args.containsKey(AppInfoBase.ARG_PACKAGE_UID) ? args.getInt(AppInfoBase.ARG_PACKAGE_UID) : intent.getIntExtra(Settings.EXTRA_APP_UID, -1); if (uid == -1 || TextUtils.isEmpty(pkg)) { Log.w(TAG, "Missing extras: " + Settings.EXTRA_APP_PACKAGE + " was " + pkg + ", " + Settings.EXTRA_APP_UID + " was " + uid); Loading @@ -136,17 +139,10 @@ public class AppNotificationSettings extends SettingsPreferenceFragment { mAppRow = mBackend.loadAppRow(pm, info.applicationInfo); if (intent.hasExtra(EXTRA_HAS_SETTINGS_INTENT)) { // use settings intent from extra if (intent.getBooleanExtra(EXTRA_HAS_SETTINGS_INTENT, false)) { mAppRow.settingsIntent = intent.getParcelableExtra(EXTRA_SETTINGS_INTENT); } } else { // load settings intent ArrayMap<String, AppRow> rows = new ArrayMap<String, AppRow>(); rows.put(mAppRow.pkg, mAppRow); collectConfigActivities(getPackageManager(), rows); } mBlock.setChecked(mAppRow.banned); updateDependents(mAppRow.banned); Loading Loading
src/com/android/settings/applications/AppInfoBase.java +3 −1 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment implements ApplicationsState.Callbacks { public static final String ARG_PACKAGE_NAME = "package"; public static final String ARG_PACKAGE_UID = "uid"; protected static final String TAG = AppInfoBase.class.getSimpleName(); protected static final boolean localLOGV = false; Loading Loading @@ -197,10 +198,11 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment refreshUi(); } public static void startAppInfoFragment(Class<? extends AppInfoBase> fragment, int titleRes, public static void startAppInfoFragment(Class<?> fragment, int titleRes, String pkg, int uid, Fragment source, int request) { Bundle args = new Bundle(); args.putString(AppInfoBase.ARG_PACKAGE_NAME, pkg); args.putInt(AppInfoBase.ARG_PACKAGE_UID, uid); Intent intent = Utils.onBuildStartFragmentIntent(source.getActivity(), fragment.getName(), args, null, titleRes, null, false); Loading
src/com/android/settings/applications/InstalledAppDetails.java +6 −12 Original line number Diff line number Diff line Loading @@ -70,6 +70,7 @@ import com.android.settings.fuelgauge.BatteryEntry; import com.android.settings.fuelgauge.PowerUsageDetail; import com.android.settings.net.ChartData; import com.android.settings.net.ChartDataLoader; import com.android.settings.notification.AppNotificationSettings; import com.android.settings.notification.NotificationBackend; import com.android.settings.notification.NotificationBackend.AppRow; Loading Loading @@ -626,25 +627,17 @@ public class InstalledAppDetails extends AppInfoBase } } private void startAppInfoFragment(Class<? extends AppInfoBase> fragment, CharSequence title) { private void startAppInfoFragment(Class<?> fragment, CharSequence title) { // start new fragment to display extended information Bundle args = new Bundle(); args.putString(InstalledAppDetails.ARG_PACKAGE_NAME, mAppEntry.info.packageName); args.putString(ARG_PACKAGE_NAME, mAppEntry.info.packageName); args.putInt(ARG_PACKAGE_UID, mAppEntry.info.uid); args.putBoolean(AppInfoWithHeader.EXTRA_HIDE_INFO_BUTTON, true); SettingsActivity sa = (SettingsActivity) getActivity(); sa.startPreferencePanel(fragment.getName(), args, -1, title, this, SUB_INFO_FRAGMENT); } private void startNotifications() { // start new fragment to display extended information getActivity().startActivity(new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) .putExtra(AppInfoWithHeader.EXTRA_HIDE_INFO_BUTTON, true) .putExtra(Settings.EXTRA_APP_PACKAGE, mAppEntry.info.packageName) .putExtra(Settings.EXTRA_APP_UID, mAppEntry.info.uid)); } /* * Method implementing functionality of buttons clicked * @see android.view.View.OnClickListener#onClick(android.view.View) Loading Loading @@ -680,7 +673,8 @@ public class InstalledAppDetails extends AppInfoBase if (preference == mStoragePreference) { startAppInfoFragment(AppStorageSettings.class, mStoragePreference.getTitle()); } else if (preference == mNotificationPreference) { startNotifications(); startAppInfoFragment(AppNotificationSettings.class, getString(R.string.app_notifications_title)); } else if (preference == mPermissionsPreference) { startManagePermissionsActivity(); } else if (preference == mLaunchPreference) { Loading
src/com/android/settings/applications/ManageApplications.java +4 −7 Original line number Diff line number Diff line Loading @@ -68,6 +68,7 @@ import com.android.settings.applications.ApplicationsState.AppFilter; import com.android.settings.applications.ApplicationsState.CompoundFilter; import com.android.settings.applications.ApplicationsState.VolumeFilter; import com.android.settings.fuelgauge.HighPowerDetail; import com.android.settings.notification.AppNotificationSettings; import com.android.settings.notification.NotificationBackend; import com.android.settings.notification.NotificationBackend.AppRow; Loading Loading @@ -422,14 +423,10 @@ public class ManageApplications extends InstrumentedFragment // utility method used to start sub activity private void startApplicationDetailsActivity() { Activity activity = getActivity(); switch (mListType) { case LIST_TYPE_NOTIFICATION: activity.startActivityAsUser(new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) .putExtra(Settings.EXTRA_APP_PACKAGE, mCurrentPkgName) .putExtra(Settings.EXTRA_APP_UID, mCurrentUid), new UserHandle(UserHandle.getUserId(mCurrentUid))); startAppInfoFragment(AppNotificationSettings.class, R.string.app_notifications_title); break; case LIST_TYPE_DOMAINS_URLS: startAppInfoFragment(AppLaunchSettings.class, R.string.auto_launch_label); Loading @@ -452,7 +449,7 @@ public class ManageApplications extends InstrumentedFragment } } private void startAppInfoFragment(Class<? extends AppInfoBase> fragment, int titleRes) { private void startAppInfoFragment(Class<?> fragment, int titleRes) { AppInfoBase.startAppInfoFragment(fragment, titleRes, mCurrentPkgName, mCurrentUid, this, INSTALLED_APP_DETAILS); } Loading
src/com/android/settings/notification/AppNotificationSettings.java +13 −17 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import com.android.settings.AppHeader; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; import com.android.settings.Utils; import com.android.settings.applications.AppInfoBase; import com.android.settings.applications.AppInfoWithHeader; import com.android.settings.notification.NotificationBackend.AppRow; Loading @@ -59,9 +60,6 @@ public class AppNotificationSettings extends SettingsPreferenceFragment { private static final String KEY_SENSITIVE = "sensitive"; private static final String KEY_APP_SETTINGS = "app_settings"; static final String EXTRA_HAS_SETTINGS_INTENT = "has_settings_intent"; static final String EXTRA_SETTINGS_INTENT = "settings_intent"; private static final Intent APP_NOTIFICATION_PREFS_CATEGORY_INTENT = new Intent(Intent.ACTION_MAIN) .addCategory(Notification.INTENT_CATEGORY_NOTIFICATION_PREFERENCES); Loading Loading @@ -101,15 +99,20 @@ public class AppNotificationSettings extends SettingsPreferenceFragment { super.onCreate(savedInstanceState); mContext = getActivity(); Intent intent = getActivity().getIntent(); Bundle args = getArguments(); if (DEBUG) Log.d(TAG, "onCreate getIntent()=" + intent); if (intent == null) { if (intent == null && args == null) { Log.w(TAG, "No intent"); toastAndFinish(); return; } final int uid = intent.getIntExtra(Settings.EXTRA_APP_UID, -1); final String pkg = intent.getStringExtra(Settings.EXTRA_APP_PACKAGE); final String pkg = args != null && args.containsKey(AppInfoBase.ARG_PACKAGE_NAME) ? args.getString(AppInfoBase.ARG_PACKAGE_NAME) : intent.getStringExtra(Settings.EXTRA_APP_PACKAGE); final int uid = args != null && args.containsKey(AppInfoBase.ARG_PACKAGE_UID) ? args.getInt(AppInfoBase.ARG_PACKAGE_UID) : intent.getIntExtra(Settings.EXTRA_APP_UID, -1); if (uid == -1 || TextUtils.isEmpty(pkg)) { Log.w(TAG, "Missing extras: " + Settings.EXTRA_APP_PACKAGE + " was " + pkg + ", " + Settings.EXTRA_APP_UID + " was " + uid); Loading @@ -136,17 +139,10 @@ public class AppNotificationSettings extends SettingsPreferenceFragment { mAppRow = mBackend.loadAppRow(pm, info.applicationInfo); if (intent.hasExtra(EXTRA_HAS_SETTINGS_INTENT)) { // use settings intent from extra if (intent.getBooleanExtra(EXTRA_HAS_SETTINGS_INTENT, false)) { mAppRow.settingsIntent = intent.getParcelableExtra(EXTRA_SETTINGS_INTENT); } } else { // load settings intent ArrayMap<String, AppRow> rows = new ArrayMap<String, AppRow>(); rows.put(mAppRow.pkg, mAppRow); collectConfigActivities(getPackageManager(), rows); } mBlock.setChecked(mAppRow.banned); updateDependents(mAppRow.banned); Loading