Fix loading bug when switching filters.

Also auto fix some lint issues.

Bug: 243337537
Test: Manual
Change-Id: I55a393517ae01d6a8c17106a3e7750323838cebb
(cherry picked from commit 67599bce4e)
Merged-In: I55a393517ae01d6a8c17106a3e7750323838cebb
This commit is contained in:
Tiffany Nguyen
2022-08-23 01:29:14 +00:00
committed by YK Hung
parent c2ad30d432
commit 260c82477c

View File

@@ -318,7 +318,7 @@ public class ManageApplications extends InstrumentedFragment
mListType = LIST_TYPE_ALARMS_AND_REMINDERS; mListType = LIST_TYPE_ALARMS_AND_REMINDERS;
} else if (className.equals(Settings.NotificationAppListActivity.class.getName()) } else if (className.equals(Settings.NotificationAppListActivity.class.getName())
|| className.equals( || className.equals(
Settings.NotificationReviewPermissionsActivity.class.getName())) { Settings.NotificationReviewPermissionsActivity.class.getName())) {
mListType = LIST_TYPE_NOTIFICATION; mListType = LIST_TYPE_NOTIFICATION;
mUsageStatsManager = IUsageStatsManager.Stub.asInterface( mUsageStatsManager = IUsageStatsManager.Stub.asInterface(
ServiceManager.getService(Context.USAGE_STATS_SERVICE)); ServiceManager.getService(Context.USAGE_STATS_SERVICE));
@@ -920,8 +920,9 @@ public class ManageApplications extends InstrumentedFragment
/** /**
* Returns a resource ID of title based on what type of app list is * Returns a resource ID of title based on what type of app list is
*
* @param intent the intent of the activity that might include a specified title * @param intent the intent of the activity that might include a specified title
* @param args the args that includes a class name of app list * @param args the args that includes a class name of app list
*/ */
public static int getTitleResId(@NonNull Intent intent, Bundle args) { public static int getTitleResId(@NonNull Intent intent, Bundle args) {
int screenTitle = intent.getIntExtra( int screenTitle = intent.getIntExtra(
@@ -944,13 +945,13 @@ public class ManageApplications extends InstrumentedFragment
screenTitle = R.string.change_wifi_state_title; screenTitle = R.string.change_wifi_state_title;
} else if (className.equals(Settings.ManageExternalStorageActivity.class.getName())) { } else if (className.equals(Settings.ManageExternalStorageActivity.class.getName())) {
screenTitle = R.string.manage_external_storage_title; screenTitle = R.string.manage_external_storage_title;
} else if (className.equals(Settings.MediaManagementAppsActivity.class.getName())) { } else if (className.equals(Settings.MediaManagementAppsActivity.class.getName())) {
screenTitle = R.string.media_management_apps_title; screenTitle = R.string.media_management_apps_title;
} else if (className.equals(Settings.AlarmsAndRemindersActivity.class.getName())) { } else if (className.equals(Settings.AlarmsAndRemindersActivity.class.getName())) {
screenTitle = R.string.alarms_and_reminders_title; screenTitle = R.string.alarms_and_reminders_title;
} else if (className.equals(Settings.NotificationAppListActivity.class.getName()) } else if (className.equals(Settings.NotificationAppListActivity.class.getName())
|| className.equals( || className.equals(
Settings.NotificationReviewPermissionsActivity.class.getName())) { Settings.NotificationReviewPermissionsActivity.class.getName())) {
screenTitle = R.string.app_notifications_title; screenTitle = R.string.app_notifications_title;
} else if (className.equals(AppLocaleDetails.class.getName())) { } else if (className.equals(AppLocaleDetails.class.getName())) {
screenTitle = R.string.app_locales_picker_menu_title; screenTitle = R.string.app_locales_picker_menu_title;
@@ -1194,11 +1195,11 @@ public class ManageApplications extends InstrumentedFragment
} else { } else {
rebuild(R.id.sort_order_alpha, true); rebuild(R.id.sort_order_alpha, true);
} }
return;
} else if (mManageApplications.mListType == LIST_TYPE_BATTERY_OPTIMIZATION) { } else if (mManageApplications.mListType == LIST_TYPE_BATTERY_OPTIMIZATION) {
logAppBatteryUsage(filterType); logAppBatteryUsage(filterType);
} else {
rebuild();
} }
rebuild();
} }
public void resume(int sort) { public void resume(int sort) {
@@ -1333,7 +1334,7 @@ public class ManageApplications extends InstrumentedFragment
} }
private void logAppBatteryUsage(int filterType) { private void logAppBatteryUsage(int filterType) {
switch(filterType) { switch (filterType) {
case FILTER_APPS_BATTERY_UNRESTRICTED: case FILTER_APPS_BATTERY_UNRESTRICTED:
logAction(SettingsEnums.ACTION_BATTERY_OPTIMIZED_APPS_FILTER_UNRESTRICTED); logAction(SettingsEnums.ACTION_BATTERY_OPTIMIZED_APPS_FILTER_UNRESTRICTED);
break; break;
@@ -1558,6 +1559,7 @@ public class ManageApplications extends InstrumentedFragment
/** /**
* Check item in the list shall enable or disable. * Check item in the list shall enable or disable.
*
* @param position The item position in the list * @param position The item position in the list
*/ */
public boolean isEnabled(int position) { public boolean isEnabled(int position) {