OSDN Git Service

Remove unused system properties
authorInseob Kim <inseob@google.com>
Wed, 19 Dec 2018 03:05:22 +0000 (12:05 +0900)
committerInseob Kim <inseob@google.com>
Wed, 19 Dec 2018 03:25:34 +0000 (12:25 +0900)
Properties ro.config.license_path and ro.config.manual_path are not set
from anywhere but only from a test.

Bug: N/A
Test: mma -j
Change-Id: I651405f3a201f5129bf37059e96e7bcc5efa73bf
(cherry picked from commit 31e37683f0e859d355d0bbb57500498cc0de3962)

src/com/android/settings/ManualDisplayActivity.java
src/com/android/settings/SettingsLicenseActivity.java
tests/robotests/src/com/android/settings/SettingsLicenseActivityTest.java

index 8be4fee..8effc7b 100644 (file)
@@ -22,7 +22,6 @@ import android.content.Intent;
 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 @@ import java.io.File;
 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 @@ public class ManualDisplayActivity extends Activity {
             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;
         }
index 2581ed9..6f62057 100644 (file)
@@ -21,7 +21,6 @@ import android.content.ContentResolver;
 import android.content.Intent;
 import android.net.Uri;
 import android.os.Bundle;
-import android.os.SystemProperties;
 import android.text.TextUtils;
 import android.util.Log;
 import android.widget.Toast;
@@ -44,8 +43,7 @@ public class SettingsLicenseActivity extends FragmentActivity implements
             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;
 
@@ -53,10 +51,9 @@ public class SettingsLicenseActivity extends FragmentActivity implements
     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();
         }
@@ -95,22 +92,6 @@ public class SettingsLicenseActivity extends FragmentActivity implements
         }
     }
 
-    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
@@ -139,10 +120,6 @@ public class SettingsLicenseActivity extends FragmentActivity implements
         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;
index 6c57309..e98ca31 100644 (file)
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.spy;
 import android.app.Application;
 import android.content.Intent;
 import android.net.Uri;
-import android.os.SystemProperties;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -66,8 +65,6 @@ public class SettingsLicenseActivityTest {
 
     @Test
     public void testOnCreateWithValidHtmlFile() {
-        SystemProperties.set("ro.config.license_path", "/system/etc/NOTICE.html.gz");
-
         doReturn(true).when(mActivity).isFileValid(any());
         mActivity.onCreate(null);