Snap for 8570526 from f31c0342a77f8f371df4d2b6cd98426247a35174 to mainline-mediaprovider-release

Change-Id: I51e3278b29adbbcec15df04c76c12a26ce0e5e77
diff --git a/Android.bp b/Android.bp
index 5217736..f498677 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,3 +1,20 @@
+package {
+    default_applicable_licenses: ["packages_apps_Gallery_license"],
+}
+
+// Added automatically by a large-scale-change
+// See: http://go/android-license-faq
+license {
+    name: "packages_apps_Gallery_license",
+    visibility: [":__subpackages__"],
+    license_kinds: [
+        "SPDX-license-identifier-Apache-2.0",
+    ],
+    license_text: [
+        "NOTICE",
+    ],
+}
+
 android_app {
     name: "Gallery",
     srcs: ["src/**/*.java"],
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 5ebdd07..d2b0947 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -23,6 +23,7 @@
                 android:configChanges="orientation|keyboardHidden"
                 android:icon="@drawable/ic_launcher_gallery"
                 android:clearTaskOnLaunch="true"
+                android:exported="true"
                 android:taskAffinity="android.task.pictures">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -33,6 +34,7 @@
         <activity android:name="com.android.camera.ImageGallery"
                 android:label="@string/gallery_label"
                 android:configChanges="orientation|keyboardHidden"
+                android:exported="true"
                 android:icon="@drawable/ic_launcher_gallery">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -76,6 +78,7 @@
             android:name="com.android.camera.CropImage"
             android:process=":CropImage"
             android:configChanges="orientation|keyboardHidden"
+            android:exported="true"
             android:label="@string/crop_label">
             <intent-filter android:label="@string/crop_label">
                 <action android:name="com.android.camera.action.CROP" />
@@ -88,6 +91,7 @@
         <activity android:name="com.android.camera.ViewImage"
                 android:label="@string/view_label"
                 android:screenOrientation="behind"
+                android:exported="true"
                 android:configChanges="orientation|keyboardHidden">
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
@@ -99,6 +103,7 @@
                 android:label="@string/movieviewlabel"
                 android:screenOrientation="landscape"
                 android:configChanges="orientation|keyboardHidden"
+                android:exported="true"
                 android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
              <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
@@ -129,6 +134,7 @@
         </activity>
 
         <activity android:name="com.android.camera.GallerySettings"
+                android:exported="true"
                 android:label="@string/preferences_label">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -138,6 +144,7 @@
 
         <activity android:name="com.android.camera.Wallpaper"
                 android:label="@string/camera_setas_wallpaper"
+                android:exported="true"
                 android:icon="@drawable/ic_launcher_gallery">
             <intent-filter>
                 <action android:name="android.intent.action.ATTACH_DATA" />
@@ -148,6 +155,7 @@
 
         <activity android:name="com.android.camera.PickWallpaper"
                 android:label="@string/camera_pick_wallpaper"
+                android:exported="true"
                 android:icon="@drawable/ic_launcher_gallery">
             <intent-filter>
                 <action android:name="android.intent.action.SET_WALLPAPER" />
@@ -156,6 +164,7 @@
         </activity>
         <receiver android:name="com.android.camera.PhotoAppWidgetProvider"
                 android:label="@string/gadget_title"
+                android:exported="true"
                 android:icon="@drawable/ic_launcher_gallery">
             <intent-filter>
                 <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
@@ -165,7 +174,8 @@
         </receiver>
 
         <!-- We configure a widget by asking to pick a photo, then crop it, and store the config internally -->
-        <activity android:name="com.android.camera.PhotoAppWidgetConfigure">
+        <activity android:name="com.android.camera.PhotoAppWidgetConfigure"
+            android:exported="true">
             <intent-filter>
                 <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
             </intent-filter>
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/src/com/android/camera/GalleryPicker.java b/src/com/android/camera/GalleryPicker.java
index 2f29691..a7d0655 100644
--- a/src/com/android/camera/GalleryPicker.java
+++ b/src/com/android/camera/GalleryPicker.java
@@ -282,7 +282,8 @@
         intentFilter.addAction(Intent.ACTION_MEDIA_EJECT);
         intentFilter.addDataScheme("file");
 
-        registerReceiver(mReceiver, intentFilter);
+        registerReceiver(mReceiver, intentFilter,
+                Context.RECEIVER_EXPORTED_UNAUDITED);
 
         getContentResolver().registerContentObserver(
                 MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
diff --git a/src/com/android/camera/ImageGallery.java b/src/com/android/camera/ImageGallery.java
index c4bdb84..bc050c7 100644
--- a/src/com/android/camera/ImageGallery.java
+++ b/src/com/android/camera/ImageGallery.java
@@ -467,7 +467,8 @@
                 }
             }
         };
-        registerReceiver(mReceiver, intentFilter);
+        registerReceiver(mReceiver, intentFilter,
+                Context.RECEIVER_EXPORTED_UNAUDITED);
         rebake(false, ImageManager.isMediaScannerScanning(
                 getContentResolver()));
     }
diff --git a/tests/Android.bp b/tests/Android.bp
index e5879ac..53bde64 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -1,3 +1,12 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "packages_apps_Gallery_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["packages_apps_Gallery_license"],
+}
+
 android_test {
     name: "GalleryTests",
     certificate: "media",