OSDN Git Service

app/Gallery2/Gallery2.apk app - update the version to target P (28) or higher. Use...
authorRaman Tenneti <rtenneti@google.com>
Fri, 18 Jan 2019 21:54:41 +0000 (13:54 -0800)
committerRaman Tenneti <rtenneti@google.com>
Tue, 22 Jan 2019 20:03:14 +0000 (20:03 +0000)
Bug: 115499280
Bug: 119501125

Test: manual - Tested the Gallery UI manually on Pixel phone and ran the following Gallery CTS tests.

$ make -j 40
  -rw-r--r-- 1 rtenneti primarygroup 5505290 Jan 18 18:10 out/target/product/marlin/system/product/app/Gallery2/Gallery2.apk

$ adb install -r -d out/target/product/marlin/system/product/app/Gallery2/Gallery2.apk

$ forrest test \
  --test_location=remote \
  --test_bench_config=presubmit/avd-cf \
  --gerrit_hostname android th:cl:878181:aosp_cf_x86_phone-userdebug:aosp-master \
  atp:avd/avd_boot_test

   https://forrest.googleplex.com/request/L36600000251931014

CTS tests for Gallery2 app
--------------------------
$ make CtsWidgetTestCases -j
  -rw-r--r-- 1 rtenneti primarygroup 3308652 Jan 22 11:28 out/host/linux-x86/cts/android-cts/testcases/CtsWidgetTestCases.apk

./development/testrunner/runtest.py --path cts/tests/tests/widget/src/android/widget/cts/GalleryTest.java
  android.widget.cts.GalleryTest:................
  Time: 3.271
  OK (16 tests)

./development/testrunner/runtest.py --path cts/tests/tests/view/src/android/view/cts/ViewTest.java
  android.view.cts.ViewTest:...
  Time: 45.6
  OK (217 tests)

./development/testrunner/runtest.py --path cts/tests/tests/text/src/android/text/method/cts/CharacterPickerDialogTest.java
  android.text.method.cts.CharacterPickerDialogTest:....
  Time: 0.886
  OK (4 tests)

./development/testrunner/runtest.py --path cts/tests/tests/widget/src/android/widget/cts/Gallery_LayoutParamsTest.java
  android.widget.cts.Gallery_LayoutParamsTest:.
  Time: 0.059
  OK (1 test)

./development/testrunner/runtest.py --path cts/tests/tests/widget/src/android/widget/cts/AbsSpinnerTest.java
  android.widget.cts.AbsSpinnerTest:.........
  Time: 1.646
  OK (9 tests)

Change-Id: I9cd9ae3aac2fe09d9da91e859828ab9eec49ccab

AndroidManifest.xml
proguard.flags
src/com/android/gallery3d/app/PackagesMonitor.java

index 0263e6d..43439f9 100644 (file)
@@ -7,7 +7,7 @@
 
     <original-package android:name="com.android.gallery3d" />
 
-    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="24" />
+    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="28" />
 
     <permission android:name="com.android.gallery3d.permission.GALLERY_PROVIDER"
             android:protectionLevel="signatureOrSystem" />
                 <data android:scheme="package"/>
             </intent-filter>
         </receiver>
-        <service android:name="com.android.gallery3d.app.PackagesMonitor$AsyncService"/>
+        <service android:name="com.android.gallery3d.app.PackagesMonitor$AsyncService"
+                 android:permission="android.permission.BIND_JOB_SERVICE"
+                 android:exported="true"/>
         <service android:name="com.android.gallery3d.gadget.WidgetService"
                 android:permission="android.permission.BIND_REMOTEVIEWS"/>
         <activity android:name="com.android.gallery3d.gadget.WidgetConfigure"
index 72cba51..5fde2d3 100644 (file)
@@ -47,6 +47,9 @@
 -keep interface com.actionbarsherlock.** { *; }
 -keepattributes *Annotation*
 
+# Required for JobIntentService
+-keep class androidx.core.app.CoreComponentFactory { *; }
+
 # Required for mp4parser
 -keep public class * implements com.coremedia.iso.boxes.Box
 
index 9b2412f..be262fd 100644 (file)
@@ -22,6 +22,7 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.preference.PreferenceManager;
+import androidx.core.app.JobIntentService;
 
 import com.android.gallery3d.picasasource.PicasaSource;
 import com.android.gallery3d.util.LightCycleHelper;
@@ -37,16 +38,18 @@ public class PackagesMonitor extends BroadcastReceiver {
     @Override
     public void onReceive(final Context context, final Intent intent) {
         intent.setClass(context, AsyncService.class);
-        context.startService(intent);
+        AsyncService.enqueueWork(context, intent);
     }
 
-    public static class AsyncService extends IntentService {
-        public AsyncService() {
-            super("GalleryPackagesMonitorAsync");
+    public static class AsyncService extends JobIntentService {
+        public static final int JOB_ID = 1;
+
+        public static void enqueueWork(Context context, Intent work) {
+            enqueueWork(context, AsyncService.class, JOB_ID, work);
         }
 
         @Override
-        protected void onHandleIntent(Intent intent) {
+        protected void onHandleWork(Intent intent) {
             onReceiveAsync(this, intent);
         }
     }