summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/SettingsLicenseActivity.java
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-15 16:12:13 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-15 16:12:13 -0800
commit1152aff9d0767e528aa4a40cc8acb51b9c21d2e7 (patch)
treeb15c0910b7737aeb90a6b3f11d33d1877285032d /src/com/android/settings/SettingsLicenseActivity.java
parent5962e18d0e5741511e78102a3746828b05f9f9ea (diff)
downloadpackages_apps_Settings-1152aff9d0767e528aa4a40cc8acb51b9c21d2e7.tar.gz
packages_apps_Settings-1152aff9d0767e528aa4a40cc8acb51b9c21d2e7.tar.bz2
packages_apps_Settings-1152aff9d0767e528aa4a40cc8acb51b9c21d2e7.zip
auto import from //branches/cupcake/...@126645
Diffstat (limited to 'src/com/android/settings/SettingsLicenseActivity.java')
-rw-r--r--src/com/android/settings/SettingsLicenseActivity.java34
1 files changed, 21 insertions, 13 deletions
diff --git a/src/com/android/settings/SettingsLicenseActivity.java b/src/com/android/settings/SettingsLicenseActivity.java
index c40dd0719..0b809e19a 100644
--- a/src/com/android/settings/SettingsLicenseActivity.java
+++ b/src/com/android/settings/SettingsLicenseActivity.java
@@ -25,9 +25,12 @@ import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.zip.GZIPInputStream;
import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
@@ -39,10 +42,10 @@ public class SettingsLicenseActivity extends AlertActivity {
private static final String TAG = "SettingsLicenseActivity";
private static final boolean LOGV = false || Config.LOGV;
-
- private static final String DEFAULT_LICENSE_PATH = "/system/etc/NOTICE.html";
+
+ private static final String DEFAULT_LICENSE_PATH = "/system/etc/NOTICE.html.gz";
private static final String PROPERTY_LICENSE_PATH = "ro.config.license_path";
-
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -54,14 +57,19 @@ public class SettingsLicenseActivity extends AlertActivity {
return;
}
- FileReader fileReader = null;
+ InputStreamReader inputReader = null;
StringBuilder data = null;
try {
- data = new StringBuilder(2048);
+ data = new StringBuilder(2048);
char tmp[] = new char[2048];
int numRead;
- fileReader = new FileReader(fileName);
- while ((numRead = fileReader.read(tmp)) >= 0) {
+ if (fileName.endsWith(".gz")) {
+ inputReader = new InputStreamReader(
+ new GZIPInputStream(new FileInputStream(fileName)));
+ } else {
+ inputReader = new FileReader(fileName);
+ }
+ while ((numRead = inputReader.read(tmp)) >= 0) {
data.append(tmp, 0, numRead);
}
} catch (FileNotFoundException e) {
@@ -74,19 +82,19 @@ public class SettingsLicenseActivity extends AlertActivity {
return;
} finally {
try {
- if (fileReader != null) {
- fileReader.close();
+ if (inputReader != null) {
+ inputReader.close();
}
} catch (IOException e) {
}
}
-
+
if (TextUtils.isEmpty(data)) {
Log.e(TAG, "License HTML is empty (from " + fileName + ")");
showErrorAndFinish();
return;
}
-
+
WebView webView = new WebView(this);
// Begin the loading. This will be done in a separate thread in WebView.
@@ -98,7 +106,7 @@ public class SettingsLicenseActivity extends AlertActivity {
mAlert.setTitle(getString(R.string.settings_license_activity_title));
}
});
-
+
final AlertController.AlertParams p = mAlertParams;
p.mTitle = getString(R.string.settings_license_activity_loading);
p.mView = webView;
@@ -111,5 +119,5 @@ public class SettingsLicenseActivity extends AlertActivity {
.show();
finish();
}
-
+
}