Merge "Add PreferenceChangeListener to ApnSettings"
diff --git a/color-check-baseline.xml b/color-check-baseline.xml
index 7ce4da7..b155634 100644
--- a/color-check-baseline.xml
+++ b/color-check-baseline.xml
@@ -2,6 +2,18 @@
<issues format="4">
<issue
+ id="LintError"
+ severity="Error"
+ message="No `.class` files were found in project ".", so none of the classfile based checks could be run. Does the project need to be built first?"
+ category="Lint"
+ priority="10"
+ summary="Lint Failure"
+ explanation="This issue type represents a problem running lint itself. Examples include failure to find bytecode for source files (which means certain detectors could not be run), parsing errors in lint configuration files, etc.
These errors are not errors in your own code, but they are shown to make it clear that some checks were not completed.">
+ <location
+ file="."/>
+ </issue>
+
+ <issue
id="HardCodedColor"
severity="Error"
message="Avoid using hardcoded color"
@@ -2141,7 +2153,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/layout/radio_info.xml"
- line="116"
+ line="110"
column="13"/>
</issue>
@@ -2157,7 +2169,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/layout/radio_info.xml"
- line="135"
+ line="129"
column="13"/>
</issue>
@@ -2173,7 +2185,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/layout/radio_info.xml"
- line="165"
+ line="175"
column="13"/>
</issue>
@@ -2189,7 +2201,55 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="res/layout/radio_info.xml"
- line="303"
+ line="205"
+ column="13"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" android:background="#000000" />"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/layout/radio_info.xml"
+ line="232"
+ column="13"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" android:background="#000000" />"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/layout/radio_info.xml"
+ line="256"
+ column="13"/>
+ </issue>
+
+ <issue
+ id="HardCodedColor"
+ severity="Error"
+ message="Avoid using hardcoded color"
+ category="Correctness"
+ priority="4"
+ summary="Using hardcoded color"
+ explanation="Hardcoded color values are bad because theme changes cannot be uniformly applied.Instead use the theme specific colors such as `?android:attr/textColorPrimary` in attributes.
This ensures that a theme change from a light to a dark theme can be uniformlyapplied across the app."
+ errorLine1=" android:background="#000000" />"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="res/layout/radio_info.xml"
+ line="293"
column="13"/>
</issue>
@@ -2429,7 +2489,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rXC/strings.xml"
- line="2531"
+ line="2422"
column="168"/>
</issue>
@@ -2444,8 +2504,8 @@
errorLine1=" <string name="sync_plug" msgid="3905078969081888738"><font fgcolor="#ffffffff">"Welcome to Google sync!"</font>" \nA Google approach to syncing data to allow access to your contacts, appointments and more from wherever you are."</string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
- file="res/values-en-rAU/strings.xml"
- line="2532"
+ file="res/values-en-rCA/strings.xml"
+ line="2423"
column="64"/>
</issue>
@@ -2460,8 +2520,8 @@
errorLine1=" <string name="sync_plug" msgid="3905078969081888738"><font fgcolor="#ffffffff">"Welcome to Google sync!"</font>" \nA Google approach to syncing data to allow access to your contacts, appointments and more from wherever you are."</string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
- file="res/values-en-rCA/strings.xml"
- line="2532"
+ file="res/values-en-rAU/strings.xml"
+ line="2541"
column="64"/>
</issue>
@@ -2477,7 +2537,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rGB/strings.xml"
- line="2532"
+ line="2541"
column="64"/>
</issue>
@@ -2493,7 +2553,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values-en-rIN/strings.xml"
- line="2532"
+ line="2541"
column="64"/>
</issue>
@@ -2509,7 +2569,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~">
<location
file="res/values/strings.xml"
- line="5920"
+ line="5925"
column="36"/>
</issue>
diff --git a/src/com/android/settings/ManualDisplayActivity.java b/src/com/android/settings/ManualDisplayActivity.java
index 8be4fee..8effc7b 100644
--- a/src/com/android/settings/ManualDisplayActivity.java
+++ b/src/com/android/settings/ManualDisplayActivity.java
@@ -22,7 +22,6 @@
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
-import android.os.SystemProperties;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;
@@ -35,8 +34,7 @@
public class ManualDisplayActivity extends Activity {
private static final String TAG = "SettingsManualActivity";
- private static final String DEFAULT_MANUAL_PATH = "/system/etc/MANUAL.html.gz";
- private static final String PROPERTY_MANUAL_PATH = "ro.config.manual_path";
+ private static final String MANUAL_PATH = "/system/etc/MANUAL.html.gz";
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -47,16 +45,9 @@
finish(); // No manual to display for this device
}
- final String path = SystemProperties.get(PROPERTY_MANUAL_PATH, DEFAULT_MANUAL_PATH);
- if (TextUtils.isEmpty(path)) {
- Log.e(TAG, "The system property for the manual is empty");
- showErrorAndFinish();
- return;
- }
-
- final File file = new File(path);
+ final File file = new File(MANUAL_PATH);
if (!file.exists() || file.length() == 0) {
- Log.e(TAG, "Manual file " + path + " does not exist");
+ Log.e(TAG, "Manual file " + MANUAL_PATH + " does not exist");
showErrorAndFinish();
return;
}
diff --git a/src/com/android/settings/RadioInfo.java b/src/com/android/settings/RadioInfo.java
index 1f528e3..6276b19 100644
--- a/src/com/android/settings/RadioInfo.java
+++ b/src/com/android/settings/RadioInfo.java
@@ -1199,12 +1199,10 @@
int state = mTelephonyManager.getDataState();
switch (state) {
case TelephonyManager.DATA_CONNECTED:
- //FIXME: Replace with a TelephonyManager call
- phone.setUserDataEnabled(false);
+ mTelephonyManager.setDataEnabled(false);
break;
case TelephonyManager.DATA_DISCONNECTED:
- //FIXME: Replace with a TelephonyManager call
- phone.setUserDataEnabled(true);
+ mTelephonyManager.setDataEnabled(true);
break;
default:
// do nothing
diff --git a/src/com/android/settings/SettingsLicenseActivity.java b/src/com/android/settings/SettingsLicenseActivity.java
index c1489b0..300644c 100644
--- a/src/com/android/settings/SettingsLicenseActivity.java
+++ b/src/com/android/settings/SettingsLicenseActivity.java
@@ -24,7 +24,6 @@
import android.content.Loader;
import android.net.Uri;
import android.os.Bundle;
-import android.os.SystemProperties;
import androidx.annotation.VisibleForTesting;
import androidx.core.content.FileProvider;
import android.text.TextUtils;
@@ -43,8 +42,7 @@
LoaderManager.LoaderCallbacks<File> {
private static final String TAG = "SettingsLicenseActivity";
- private static final String DEFAULT_LICENSE_PATH = "/system/etc/NOTICE.html.gz";
- private static final String PROPERTY_LICENSE_PATH = "ro.config.license_path";
+ private static final String LICENSE_PATH = "/system/etc/NOTICE.html.gz";
private static final int LOADER_ID_LICENSE_HTML_LOADER = 0;
@@ -52,10 +50,9 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- final String licenseHtmlPath =
- SystemProperties.get(PROPERTY_LICENSE_PATH, DEFAULT_LICENSE_PATH);
- if (isFilePathValid(licenseHtmlPath)) {
- showSelectedFile(licenseHtmlPath);
+ File file = new File(LICENSE_PATH);
+ if (isFileValid(file)) {
+ showHtmlFromUri(Uri.fromFile(file));
} else {
showHtmlFromDefaultXmlFiles();
}
@@ -94,22 +91,6 @@
}
}
- private void showSelectedFile(final String path) {
- if (TextUtils.isEmpty(path)) {
- Log.e(TAG, "The system property for the license file is empty");
- showErrorAndFinish();
- return;
- }
-
- final File file = new File(path);
- if (!isFileValid(file)) {
- Log.e(TAG, "License file " + path + " does not exist");
- showErrorAndFinish();
- return;
- }
- showHtmlFromUri(Uri.fromFile(file));
- }
-
private void showHtmlFromUri(Uri uri) {
// Kick off external viewer due to WebView security restrictions; we
// carefully point it at HTMLViewer, since it offers to decompress
@@ -138,10 +119,6 @@
finish();
}
- private boolean isFilePathValid(final String path) {
- return !TextUtils.isEmpty(path) && isFileValid(new File(path));
- }
-
@VisibleForTesting
boolean isFileValid(final File file) {
return file.exists() && file.length() != 0;
diff --git a/src/com/android/settings/network/ApnSettings.java b/src/com/android/settings/network/ApnSettings.java
index 25f19cf..0054e9b 100755
--- a/src/com/android/settings/network/ApnSettings.java
+++ b/src/com/android/settings/network/ApnSettings.java
@@ -277,7 +277,7 @@
private void fillList() {
final int subId = mSubscriptionInfo != null ? mSubscriptionInfo.getSubscriptionId()
: SubscriptionManager.INVALID_SUBSCRIPTION_ID;
- final Uri simApnUri = Uri.withAppendedPath(Telephony.Carriers.SIM_APN_LIST,
+ final Uri simApnUri = Uri.withAppendedPath(Telephony.Carriers.SIM_APN_URI,
String.valueOf(subId));
StringBuilder where = new StringBuilder("NOT (type='ia' AND (apn=\"\" OR apn IS NULL)) AND "
+ "user_visible!=0");
diff --git a/tests/robotests/src/com/android/settings/SettingsLicenseActivityTest.java b/tests/robotests/src/com/android/settings/SettingsLicenseActivityTest.java
index 0e1384d..7ba5787 100644
--- a/tests/robotests/src/com/android/settings/SettingsLicenseActivityTest.java
+++ b/tests/robotests/src/com/android/settings/SettingsLicenseActivityTest.java
@@ -26,7 +26,6 @@
import android.app.Application;
import android.content.Intent;
import android.net.Uri;
-import android.os.SystemProperties;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
@@ -67,8 +66,6 @@
@Test
public void testOnCreateWithValidHtmlFile() {
- SystemProperties.set("ro.config.license_path", "/system/etc/NOTICE.html.gz");
-
doReturn(true).when(mActivity).isFileValid(any());
mActivity.onCreate(null);