Fix references to resources for Settings

Bug: 293810334
Test: m Settings
Change-Id: Ie140278f492ef7e1c062ec1ecae2866c521a86aa
This commit is contained in:
Chaohui Wang
2023-07-31 15:56:42 +08:00
parent ed505c25fa
commit 2541381259
247 changed files with 859 additions and 721 deletions

View File

@@ -226,8 +226,8 @@ public class RunningServiceDetails extends InstrumentedFragment
void addServicesHeader() {
if (mNumServices == 0) {
mServicesHeader = (TextView) mInflater.inflate(R.layout.preference_category,
mAllDetails, false);
mServicesHeader = (TextView) mInflater.inflate(
androidx.preference.R.layout.preference_category, mAllDetails, false);
mServicesHeader.setText(R.string.runningservicedetails_services_title);
mAllDetails.addView(mServicesHeader);
}
@@ -236,8 +236,8 @@ public class RunningServiceDetails extends InstrumentedFragment
void addProcessesHeader() {
if (mNumProcesses == 0) {
mProcessesHeader = (TextView) mInflater.inflate(R.layout.preference_category,
mAllDetails, false);
mProcessesHeader = (TextView) mInflater.inflate(
androidx.preference.R.layout.preference_category, mAllDetails, false);
mProcessesHeader.setText(R.string.runningservicedetails_processes_title);
mAllDetails.addView(mProcessesHeader);
}

View File

@@ -42,7 +42,7 @@ public class RunningServices extends SettingsPreferenceFragment {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActivity().setTitle(R.string.runningservices_settings_title);
getActivity().setTitle(com.android.settingslib.R.string.runningservices_settings_title);
}
@Override

View File

@@ -88,9 +88,9 @@ public class ExternalSourcesDetails extends AppInfoWithHeader
UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY,
userHandle);
if ((userRestrictionSource & UserManager.RESTRICTION_SOURCE_SYSTEM) != 0) {
return context.getString(R.string.disabled_by_admin);
return context.getString(com.android.settingslib.widget.R.string.disabled_by_admin);
} else if (userRestrictionSource != 0) {
return context.getString(R.string.disabled);
return context.getString(com.android.settingslib.R.string.disabled);
}
final InstallAppsState appsState = new AppStateInstallAppsBridge(context, null, null)
.createInstallAppsStateFor(entry.info.packageName, entry.info.uid);
@@ -113,7 +113,7 @@ public class ExternalSourcesDetails extends AppInfoWithHeader
if (mUserManager.hasBaseUserRestriction(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES,
UserHandle.of(UserHandle.myUserId()))) {
mSwitchPref.setChecked(false);
mSwitchPref.setSummary(R.string.disabled);
mSwitchPref.setSummary(com.android.settingslib.R.string.disabled);
mSwitchPref.setEnabled(false);
return true;
}

View File

@@ -22,7 +22,6 @@ import android.widget.CheckBox;
import androidx.preference.PreferenceViewHolder;
import com.android.settings.R;
import com.android.settingslib.widget.TwoTargetPreference;
/** This preference has a check box in the left side. */
@@ -33,7 +32,7 @@ public class LeftSideCheckBoxPreference extends TwoTargetPreference {
public LeftSideCheckBoxPreference(Context context, AttributeSet attrs,
int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
setLayoutResource(R.layout.preference_checkable_two_target);
setLayoutResource(com.android.settingslib.R.layout.preference_checkable_two_target);
}
public LeftSideCheckBoxPreference(Context context, AttributeSet attrs, int defStyleAttr) {
@@ -51,7 +50,7 @@ public class LeftSideCheckBoxPreference extends TwoTargetPreference {
public LeftSideCheckBoxPreference(Context context, boolean isChecked) {
super(context);
mChecked = isChecked;
setLayoutResource(R.layout.preference_checkable_two_target);
setLayoutResource(com.android.settingslib.R.layout.preference_checkable_two_target);
}
@Override

View File

@@ -167,13 +167,13 @@ public class AppFilterRegistry {
mFilters[FILTER_APPS_PERSONAL] = new AppFilterItem(
ApplicationsState.FILTER_PERSONAL,
FILTER_APPS_PERSONAL,
R.string.category_personal);
com.android.settingslib.R.string.category_personal);
// Work
mFilters[FILTER_APPS_WORK] = new AppFilterItem(
ApplicationsState.FILTER_WORK,
FILTER_APPS_WORK,
R.string.category_work);
com.android.settingslib.R.string.category_work);
// Usage access screen, never displayed.
mFilters[FILTER_APPS_USAGE_ACCESS] = new AppFilterItem(
@@ -219,7 +219,7 @@ public class AppFilterRegistry {
mFilters[FILTER_ALARMS_AND_REMINDERS] = new AppFilterItem(
AppStateAlarmsAndRemindersBridge.FILTER_CLOCK_APPS,
FILTER_ALARMS_AND_REMINDERS,
R.string.alarms_and_reminders_title);
com.android.settingslib.R.string.alarms_and_reminders_title);
// Apps that can manage media files
mFilters[FILTER_APPS_MEDIA_MANAGEMENT] = new AppFilterItem(
@@ -279,7 +279,7 @@ public class AppFilterRegistry {
mFilters[FILTER_APPS_TURN_SCREEN_ON] = new AppFilterItem(
AppStateTurnScreenOnBridge.FILTER_TURN_SCREEN_ON_APPS,
FILTER_APPS_TURN_SCREEN_ON,
R.string.turn_screen_on_title);
com.android.settingslib.R.string.turn_screen_on_title);
}
public static AppFilterRegistry getInstance() {

View File

@@ -73,7 +73,7 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder {
mAppName = itemView.findViewById(android.R.id.title);
mAppIcon = itemView.findViewById(android.R.id.icon);
mSummary = itemView.findViewById(android.R.id.summary);
mDisabled = itemView.findViewById(R.id.appendix);
mDisabled = itemView.findViewById(com.android.settingslib.widget.R.id.appendix);
mSwitch = itemView.findViewById(R.id.switchWidget);
mWidgetContainer = itemView.findViewById(android.R.id.widget_frame);
mAddIcon = itemView.findViewById(R.id.add_preference_widget);
@@ -86,7 +86,7 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder {
static View newView(ViewGroup parent, boolean twoTarget, int listType) {
ViewGroup view = (ViewGroup) LayoutInflater.from(parent.getContext())
.inflate(R.layout.preference_app, parent, false);
.inflate(com.android.settingslib.widget.R.layout.preference_app, parent, false);
ViewGroup widgetFrame = view.findViewById(android.R.id.widget_frame);
if (twoTarget) {
if (widgetFrame != null) {
@@ -98,7 +98,8 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder {
.inflate(R.layout.preference_widget_primary_switch, widgetFrame, true);
}
View divider = LayoutInflater.from(parent.getContext()).inflate(
R.layout.preference_two_target_divider, view, false);
com.android.settingslib.widget.R.layout.preference_two_target_divider,
view, false);
// second to last, before widget frame
view.addView(divider, view.getChildCount() - 1);
}
@@ -110,7 +111,8 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder {
static View newHeader(ViewGroup parent, int resText) {
ViewGroup view = (ViewGroup) LayoutInflater.from(parent.getContext())
.inflate(R.layout.preference_app_header, parent, false);
.inflate(com.android.settingslib.widget.R.layout.preference_app_header,
parent, false);
TextView textView = view.findViewById(R.id.apps_top_intro_text);
textView.setText(resText);
return view;
@@ -183,7 +185,7 @@ public class ApplicationViewHolder extends RecyclerView.ViewHolder {
} else if (!info.enabled || info.enabledSetting
== PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED) {
mDisabled.setVisibility(View.VISIBLE);
mDisabled.setText(R.string.disabled);
mDisabled.setText(com.android.settingslib.R.string.disabled);
} else {
mDisabled.setVisibility(View.GONE);
}

View File

@@ -689,7 +689,8 @@ public class ManageApplications extends InstrumentedFragment
startAppInfoFragment(WriteSettingsDetails.class, R.string.write_system_settings);
break;
case LIST_TYPE_MANAGE_SOURCES:
startAppInfoFragment(ExternalSourcesDetails.class, R.string.install_other_apps);
startAppInfoFragment(ExternalSourcesDetails.class,
com.android.settingslib.R.string.install_other_apps);
break;
case LIST_TYPE_GAMES:
startAppInfoFragment(AppStorageSettings.class, R.string.game_storage_settings);
@@ -704,7 +705,7 @@ public class ManageApplications extends InstrumentedFragment
break;
case LIST_TYPE_ALARMS_AND_REMINDERS:
startAppInfoFragment(AlarmsAndRemindersDetails.class,
R.string.alarms_and_reminders_label);
com.android.settingslib.R.string.alarms_and_reminders_label);
break;
case LIST_TYPE_MEDIA_MANAGEMENT_APPS:
startAppInfoFragment(MediaManagementAppsDetails.class,
@@ -741,7 +742,8 @@ public class ManageApplications extends InstrumentedFragment
R.string.change_nfc_tag_apps_title);
break;
case LIST_TYPE_TURN_SCREEN_ON:
startAppInfoFragment(TurnScreenOnDetails.class, R.string.turn_screen_on_title);
startAppInfoFragment(TurnScreenOnDetails.class,
com.android.settingslib.R.string.turn_screen_on_title);
break;
// TODO: Figure out if there is a way where we can spin up the profile's settings
// process ahead of time, to avoid a long load of data when user clicks on a managed
@@ -1052,7 +1054,7 @@ public class ManageApplications extends InstrumentedFragment
} else if (className.equals(WriteSettingsActivity.class.getName())) {
screenTitle = R.string.write_settings;
} else if (className.equals(ManageExternalSourcesActivity.class.getName())) {
screenTitle = R.string.install_other_apps;
screenTitle = com.android.settingslib.R.string.install_other_apps;
} else if (className.equals(ChangeWifiStateActivity.class.getName())) {
screenTitle = R.string.change_wifi_state_title;
} else if (className.equals(ManageExternalStorageActivity.class.getName())) {
@@ -1060,7 +1062,7 @@ public class ManageApplications extends InstrumentedFragment
} else if (className.equals(MediaManagementAppsActivity.class.getName())) {
screenTitle = R.string.media_management_apps_title;
} else if (className.equals(AlarmsAndRemindersActivity.class.getName())) {
screenTitle = R.string.alarms_and_reminders_title;
screenTitle = com.android.settingslib.R.string.alarms_and_reminders_title;
} else if (className.equals(NotificationAppListActivity.class.getName())
|| className.equals(
NotificationReviewPermissionsActivity.class.getName())) {
@@ -1076,7 +1078,7 @@ public class ManageApplications extends InstrumentedFragment
} else if (className.equals(ChangeNfcTagAppsActivity.class.getName())) {
screenTitle = R.string.change_nfc_tag_apps_title;
} else if (className.equals(TurnScreenOnSettingsActivity.class.getName())) {
screenTitle = R.string.turn_screen_on_title;
screenTitle = com.android.settingslib.R.string.turn_screen_on_title;
} else {
if (screenTitle == -1) {
screenTitle = R.string.all_apps;

View File

@@ -208,7 +208,8 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
title.setText(appLabel);
}
final ImageView personalIconView = mHeader.findViewById(R.id.entity_header_icon_personal);
final ImageView personalIconView = mHeader.findViewById(
com.android.settingslib.widget.R.id.entity_header_icon_personal);
if (personalIconView != null) {
Drawable icon = IconDrawableFactory.newInstance(mContext)
.getBadgedIcon(mPackageInfo.applicationInfo, personalProfile.getIdentifier())
@@ -219,7 +220,8 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
personalIconView.setImageDrawable(icon);
}
final ImageView workIconView = mHeader.findViewById(R.id.entity_header_icon_work);
final ImageView workIconView = mHeader.findViewById(
com.android.settingslib.widget.R.id.entity_header_icon_work);
if (workIconView != null) {
Drawable icon = IconDrawableFactory.newInstance(mContext)
.getBadgedIcon(mPackageInfo.applicationInfo, workProfile.getIdentifier())
@@ -499,20 +501,24 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
private void enableSwitchPref() {
mSwitchPref.setChecked(true);
mSwitchPref.setTitle(R.string.interact_across_profiles_switch_enabled);
final ImageView horizontalArrowIcon = mHeader.findViewById(R.id.entity_header_swap_horiz);
final ImageView horizontalArrowIcon =
mHeader.findViewById(com.android.settingslib.widget.R.id.entity_header_swap_horiz);
if (horizontalArrowIcon != null) {
horizontalArrowIcon.setImageDrawable(
mContext.getDrawable(R.drawable.ic_swap_horiz_blue));
mContext.getDrawable(
com.android.settingslib.widget.R.drawable.ic_swap_horiz_blue));
}
}
private void disableSwitchPref() {
mSwitchPref.setChecked(false);
mSwitchPref.setTitle(R.string.interact_across_profiles_switch_disabled);
final ImageView horizontalArrowIcon = mHeader.findViewById(R.id.entity_header_swap_horiz);
final ImageView horizontalArrowIcon =
mHeader.findViewById(com.android.settingslib.widget.R.id.entity_header_swap_horiz);
if (horizontalArrowIcon != null) {
horizontalArrowIcon.setImageDrawable(
mContext.getDrawable(R.drawable.ic_swap_horiz_grey));
mContext.getDrawable(
com.android.settingslib.widget.R.drawable.ic_swap_horiz_grey));
}
}