diff options
author | Xin Li <delphij@google.com> | 2019-07-01 20:59:59 +0000 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2019-07-01 20:59:59 +0000 |
commit | 1093fb3ade180436cb8bddf2fb096a7b8989ff74 (patch) | |
tree | c58c05c0c57615d914cddddac0c93e0b15bca397 | |
parent | df3497b295448ffd4ad4d066b8a89fca0376a940 (diff) | |
parent | ba5580e4e1ac8f9f3eb1eb6338e43716ad0a70b1 (diff) | |
download | HTMLViewer-1093fb3ade180436cb8bddf2fb096a7b8989ff74.tar.gz |
DO NOT MERGE - Merge qt-dev-plus-aosp-without-vendor (5699924) into stage-aosp-mastertemp_140451723
Bug: 134405016
Change-Id: Ib30ef9131703a83089a68445736699bcb3e77dae
-rw-r--r-- | AndroidManifest.xml | 3 | ||||
-rw-r--r-- | src/com/android/htmlviewer/HTMLViewerActivity.java | 34 |
2 files changed, 1 insertions, 36 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index f0fbb1a..660c625 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -21,8 +21,6 @@ package="com.android.htmlviewer"> <original-package android:name="com.android.htmlviewer" /> - <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> - <application android:label="@string/app_label" android:supportsRtl="true"> <activity android:name="HTMLViewerActivity" @@ -31,7 +29,6 @@ <intent-filter> <category android:name="android.intent.category.DEFAULT" /> <action android:name="android.intent.action.VIEW" /> - <data android:scheme="file" /> <data android:scheme="content" /> <data android:mimeType="text/html"/> <data android:mimeType="text/plain"/> diff --git a/src/com/android/htmlviewer/HTMLViewerActivity.java b/src/com/android/htmlviewer/HTMLViewerActivity.java index 99f558e..87f75ae 100644 --- a/src/com/android/htmlviewer/HTMLViewerActivity.java +++ b/src/com/android/htmlviewer/HTMLViewerActivity.java @@ -21,7 +21,6 @@ import android.content.ActivityNotFoundException; import android.content.ContentResolver; import android.content.Intent; import android.content.pm.PackageManager; -import android.Manifest; import android.net.Uri; import android.os.Bundle; import android.provider.Browser; @@ -79,7 +78,7 @@ public class HTMLViewerActivity extends Activity { s.setDefaultTextEncodingName("utf-8"); mIntent = getIntent(); - requestPermissionAndLoad(); + loadUrl(); } private void loadUrl() { @@ -89,37 +88,6 @@ public class HTMLViewerActivity extends Activity { mWebView.loadUrl(String.valueOf(mIntent.getData())); } - private void requestPermissionAndLoad() { - Uri destination = mIntent.getData(); - if (destination != null) { - // Is this a local file? - if ("file".equals(destination.getScheme()) - && PackageManager.PERMISSION_DENIED == - checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)) { - requestPermissions(new String[] {Manifest.permission.READ_EXTERNAL_STORAGE}, 0); - } else { - loadUrl(); - } - } - } - - @Override - public void onRequestPermissionsResult(int requestCode, - String permissions[], int[] grantResults) { - // We only ever request 1 permission, so these arguments should always have the same form. - assert permissions.length == 1; - assert Manifest.permission.READ_EXTERNAL_STORAGE.equals(permissions[0]); - - if (grantResults.length == 1 && PackageManager.PERMISSION_GRANTED == grantResults[0]) { - // Try again now that we have the permission. - loadUrl(); - } else { - Toast.makeText(HTMLViewerActivity.this, - R.string.turn_on_storage_permission, Toast.LENGTH_SHORT).show(); - finish(); - } - } - @Override protected void onDestroy() { super.onDestroy(); |