Remove support for file:// items.

We've messaged since the N release that file:// Uris are going away,
and we've been crashing those apps via StrictMode for many years.

The broader storage changes in Q mean it's finally a good time to say
we only handle content:// items.

Bug: 129375805
Test: manual
Exempted-From-Owner-Approval: storage refactoring
Change-Id: I89b08591523153a80374bd444b2855ecfc04936b
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.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 @@
         s.setDefaultTextEncodingName("utf-8");
 
         mIntent = getIntent();
-        requestPermissionAndLoad();
+        loadUrl();
     }
 
     private void loadUrl() {
@@ -89,37 +88,6 @@
         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();