[Panlingual] Remove the warning message from AppLocaleDetails

Since opt-in is enabled and it will only display locales that are available or downloadable, there is no longer a need to display the warning message to users.

Bug: 228923650
Test: manual test
Change-Id: Ibd98f3a292eb09c921f4bf00dbf448c976927e5d
This commit is contained in:
James.cf Lin
2022-05-11 12:05:17 +08:00
parent fbbd1f1109
commit 85db3167e2
4 changed files with 0 additions and 87 deletions

View File

@@ -1,28 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M11,15h2v2h-2v-2zM11,7h2v6h-2L11,7zM11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"
android:fillColor="?android:attr/colorError"
android:fillType="evenOdd"/>
</vector>

View File

@@ -500,15 +500,6 @@
<!-- Title for the App's locale picker activity. [CHAR LIMIT=50]-->
<string name="app_locale_picker_title">App Language</string>
<!-- Title for the warning message of the locale picker activity. [CHAR LIMIT=50]-->
<string name="warnings_title">Update the app</string>
<!-- Summary for the warning message of the locale picker activity. [CHAR LIMIT=70]-->
<string name="warnings_summary">You need to update the app for the latest available languages</string>
<!-- Button text on warning message [CHAR LIMIT=20]-->
<string name="warnings_button_update">Update now</string>
<!-- Category for the suggested app's locales. [CHAR LIMIT=50]-->
<string name="suggested_app_locales_title">Suggested languages</string>

View File

@@ -24,13 +24,6 @@
android:title="@string/desc_app_locale_disclaimer"
android:order="1"/>
<com.android.settingslib.widget.BannerMessagePreference
android:key="key_warnings"
android:order="20"
android:icon="@drawable/ic_error_outline"
android:title="@string/warnings_title"
android:summary="@string/warnings_summary"/>
<com.android.settingslib.widget.LayoutPreference
android:key="app_locale_description"
android:order="30"

View File

@@ -21,12 +21,8 @@ import android.app.Activity;
import android.app.LocaleManager;
import android.app.settings.SettingsEnums;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.InstallSourceInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Bundle;
import android.os.LocaleList;
import android.os.UserHandle;
@@ -34,7 +30,6 @@ import android.util.FeatureFlagUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;
@@ -48,8 +43,6 @@ import com.android.settings.applications.AppLocaleUtil;
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.applications.AppUtils;
import com.android.settingslib.applications.ApplicationsState.AppEntry;
import com.android.settingslib.widget.BannerMessagePreference;
import com.android.settingslib.widget.BannerMessagePreference.AttentionLevel;
import com.android.settingslib.widget.LayoutPreference;
import java.util.Locale;
@@ -62,7 +55,6 @@ public class AppLocaleDetails extends SettingsPreferenceFragment {
private static final String TAG = "AppLocaleDetails";
private static final String KEY_APP_DESCRIPTION = "app_locale_description";
private static final String KEY_WARNINGS = "key_warnings";
private static final String KEY_APP_DISCLAIMER = "app_locale_disclaimer";
private boolean mCreated = false;
@@ -96,7 +88,6 @@ public class AppLocaleDetails extends SettingsPreferenceFragment {
mPrefOfDescription = getPreferenceScreen().findPreference(KEY_APP_DESCRIPTION);
mPrefOfDisclaimer = getPreferenceScreen().findPreference(KEY_APP_DISCLAIMER);
mApplicationInfo = getApplicationInfo(mPackageName, getContext().getUserId());
setWarningMessage();
setDisclaimerPreference();
}
@@ -119,7 +110,6 @@ public class AppLocaleDetails extends SettingsPreferenceFragment {
}
private void refreshUi() {
setWarningMessage();
setDescription();
}
@@ -156,26 +146,6 @@ public class AppLocaleDetails extends SettingsPreferenceFragment {
getPreferenceScreen().addPreference(pref);
}
private void setWarningMessage() {
BannerMessagePreference warningPreference =
(BannerMessagePreference) getPreferenceScreen().findPreference(KEY_WARNINGS);
try {
InstallSourceInfo installSourceInfo =
getContext().getPackageManager().getInstallSourceInfo(mPackageName);
if (mApplicationInfo.isSystemApp()
&& installSourceInfo.getInstallingPackageName() == null) {
warningPreference.setAttentionLevel(AttentionLevel.MEDIUM);
warningPreference.setPositiveButtonOnClickListener(mBannerButtonClickListener);
warningPreference.setPositiveButtonText(R.string.warnings_button_update);
warningPreference.setVisible(true);
} else {
warningPreference.setVisible(false);
}
} catch (NameNotFoundException e) {
Log.e(TAG, "Exception while retrieving the package installer of " + mPackageName, e);
}
}
private void setDisclaimerPreference() {
if (FeatureFlagUtils.isEnabled(
getContext(), FeatureFlagUtils.SETTINGS_APP_LOCALE_OPT_IN_ENABLED)) {
@@ -192,19 +162,6 @@ public class AppLocaleDetails extends SettingsPreferenceFragment {
}
}
private OnClickListener mBannerButtonClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(getAppSearchIntent(mPackageName));
}
};
private static Intent getAppSearchIntent(String pkg) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=" + pkg));
return intent;
}
private ApplicationInfo getApplicationInfo(String packageName, int userId) {
ApplicationInfo applicationInfo;
try {