OSDN Git Service

Merge "Re-evaluate scrim color on keyguard vis event"
authorTreeHugger Robot <treehugger-gerrit@google.com>
Thu, 12 Jul 2018 16:38:03 +0000 (16:38 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Thu, 12 Jul 2018 16:38:03 +0000 (16:38 +0000)
60 files changed:
api/current.txt
core/java/android/app/Notification.java
core/java/android/content/ContentProviderClient.java
core/java/android/hardware/location/NanoAppFilter.java
core/java/android/os/FileUtils.java
core/java/android/print/PrintFileDocumentAdapter.java
core/java/android/provider/DocumentsContract.java
core/java/android/util/Xml.java
core/java/android/view/View.java
core/jni/Android.bp
core/jni/android_text_MeasuredParagraph.cpp
core/jni/android_text_StaticLayout.cpp
core/res/res/values-mcc334-mnc03/config.xml [new file with mode: 0644]
core/res/res/values-mcc334-mnc030/config.xml [new file with mode: 0644]
core/res/res/values-mcc704-mnc03/config.xml [new file with mode: 0644]
core/res/res/values-mcc706-mnc04/config.xml [new file with mode: 0644]
core/res/res/values-mcc712-mnc04/config.xml [new file with mode: 0644]
core/res/res/values-mcc716-mnc06/config.xml [new file with mode: 0644]
core/res/res/values-mcc716-mnc10/config.xml [new file with mode: 0644]
core/res/res/values-mcc716-mnc17/config.xml [new file with mode: 0644]
core/res/res/values-mcc722-mnc07/config.xml [new file with mode: 0644]
core/res/res/values-mcc732-mnc123/config.xml [new file with mode: 0644]
core/res/res/values-mcc740-mnc00/config.xml [new file with mode: 0644]
core/tests/benchmarks/src/android/os/FileUtilsBenchmark.java
core/tests/coretests/src/android/os/FileUtilsTest.java
libs/hwui/Android.bp
packages/ExtServices/src/android/ext/services/notification/Assistant.java
packages/ExtServices/src/android/ext/services/notification/SmartActionsHelper.java [new file with mode: 0644]
packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
packages/SettingsLib/res/values-ca/strings.xml
packages/SettingsLib/res/values-ne/strings.xml
packages/SettingsLib/res/values-ta/arrays.xml
packages/SettingsLib/res/values-ta/strings.xml
packages/SettingsLib/src/com/android/settingslib/core/lifecycle/ObservableActivity.java
packages/SettingsLib/src/com/android/settingslib/core/lifecycle/ObservableDialogFragment.java
packages/SettingsLib/src/com/android/settingslib/core/lifecycle/ObservableFragment.java
packages/SettingsLib/src/com/android/settingslib/core/lifecycle/ObservablePreferenceFragment.java
packages/SettingsLib/tests/robotests/src/com/android/settingslib/core/lifecycle/LifecycleTest.java
packages/SettingsLib/tests/robotests/src/com/android/settingslib/testutils/FragmentTestUtils.java [new file with mode: 0644]
packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
packages/SystemUI/res/values/dimens.xml
packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimState.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java
sax/tests/saxtests/src/android/sax/ExpatPerformanceTest.java [deleted file]
services/core/java/com/android/server/am/AppTaskImpl.java
services/core/java/com/android/server/hdmi/Constants.java
services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java
services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java [new file with mode: 0644]
services/core/java/com/android/server/hdmi/HdmiCecMessageBuilder.java
services/core/java/com/android/server/pm/PackageInstallerSession.java
services/print/java/com/android/server/print/UserState.java
telephony/java/android/telephony/NetworkRegistrationState.java
telephony/java/android/telephony/ServiceState.java

index 94ca868..aff0309 100644 (file)
@@ -9137,6 +9137,7 @@ package android.content {
     method public android.os.Bundle call(java.lang.String, java.lang.String, android.os.Bundle) throws android.os.RemoteException;
     method public final android.net.Uri canonicalize(android.net.Uri) throws android.os.RemoteException;
     method public void close();
+    method public static void closeQuietly(android.content.ContentProviderClient);
     method public int delete(android.net.Uri, java.lang.String, java.lang.String[]) throws android.os.RemoteException;
     method public android.content.ContentProvider getLocalContentProvider();
     method public java.lang.String[] getStreamTypes(android.net.Uri, java.lang.String) throws android.os.RemoteException;
@@ -32547,6 +32548,21 @@ package android.os {
     ctor public FileUriExposedException(java.lang.String);
   }
 
+  public class FileUtils {
+    method public static void closeQuietly(java.lang.AutoCloseable);
+    method public static void closeQuietly(java.io.FileDescriptor);
+    method public static long copy(java.io.File, java.io.File) throws java.io.IOException;
+    method public static long copy(java.io.File, java.io.File, android.os.CancellationSignal, java.util.concurrent.Executor, android.os.FileUtils.ProgressListener) throws java.io.IOException;
+    method public static long copy(java.io.InputStream, java.io.OutputStream) throws java.io.IOException;
+    method public static long copy(java.io.InputStream, java.io.OutputStream, android.os.CancellationSignal, java.util.concurrent.Executor, android.os.FileUtils.ProgressListener) throws java.io.IOException;
+    method public static long copy(java.io.FileDescriptor, java.io.FileDescriptor) throws java.io.IOException;
+    method public static long copy(java.io.FileDescriptor, java.io.FileDescriptor, android.os.CancellationSignal, java.util.concurrent.Executor, android.os.FileUtils.ProgressListener) throws java.io.IOException;
+  }
+
+  public static abstract interface FileUtils.ProgressListener {
+    method public abstract void onProgress(long);
+  }
+
   public class Handler {
     ctor public Handler();
     ctor public Handler(android.os.Handler.Callback);
@@ -42510,13 +42526,11 @@ package android.telephony {
     method public java.lang.String getIccAuthentication(int, int, java.lang.String);
     method public java.lang.String getImei();
     method public java.lang.String getImei(int);
-    method public java.lang.String getTypeAllocationCode();
-    method public java.lang.String getTypeAllocationCode(int);
     method public java.lang.String getLine1Number();
-    method public java.lang.String getMeid();
-    method public java.lang.String getMeid(int);
     method public java.lang.String getManufacturerCode();
     method public java.lang.String getManufacturerCode(int);
+    method public java.lang.String getMeid();
+    method public java.lang.String getMeid(int);
     method public java.lang.String getMmsUAProfUrl();
     method public java.lang.String getMmsUserAgent();
     method public java.lang.String getNai();
@@ -42539,6 +42553,8 @@ package android.telephony {
     method public int getSimState();
     method public int getSimState(int);
     method public java.lang.String getSubscriberId();
+    method public java.lang.String getTypeAllocationCode();
+    method public java.lang.String getTypeAllocationCode(int);
     method public java.lang.String getVisualVoicemailPackageName();
     method public java.lang.String getVoiceMailAlphaTag();
     method public java.lang.String getVoiceMailNumber();
index 05bf6bf..590fbc7 100644 (file)
@@ -202,6 +202,11 @@ public class Notification implements Parcelable
      */
     private static final int MAX_REPLY_HISTORY = 5;
 
+    /**
+     * Maximum numbers of action buttons in a notification.
+     * @hide
+     */
+    public static final int MAX_ACTION_BUTTONS = 3;
 
     /**
      * If the notification contained an unsent draft for a RemoteInput when the user clicked on it,
@@ -3151,8 +3156,6 @@ public class Notification implements Parcelable
         public static final String EXTRA_REBUILD_HEADS_UP_CONTENT_VIEW_ACTION_COUNT
                 = "android.rebuild.hudViewActionCount";
 
-        private static final int MAX_ACTION_BUTTONS = 3;
-
         private static final boolean USE_ONLY_TITLE_IN_LOW_PRIORITY_SUMMARY =
                 SystemProperties.getBoolean("notifications.only_title", true);
 
@@ -7162,8 +7165,8 @@ public class Notification implements Parcelable
         }
 
         public static final class Message {
-
-            static final String KEY_TEXT = "text";
+            /** @hide */
+            public static final String KEY_TEXT = "text";
             static final String KEY_TIMESTAMP = "time";
             static final String KEY_SENDER = "sender";
             static final String KEY_SENDER_PERSON = "sender_person";
index 2d490a0..9d8c318 100644 (file)
@@ -39,6 +39,8 @@ import com.android.internal.util.Preconditions;
 
 import dalvik.system.CloseGuard;
 
+import libcore.io.IoUtils;
+
 import java.io.FileNotFoundException;
 import java.util.ArrayList;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -560,14 +562,17 @@ public class ContentProviderClient implements AutoCloseable {
         return ContentProvider.coerceToLocalContentProvider(mContentProvider);
     }
 
+    /**
+     * Closes the given object quietly, ignoring any checked exceptions. Does
+     * nothing if the given object is {@code null}.
+     */
+    public static void closeQuietly(ContentProviderClient client) {
+        IoUtils.closeQuietly(client);
+    }
+
     /** {@hide} */
     public static void releaseQuietly(ContentProviderClient client) {
-        if (client != null) {
-            try {
-                client.release();
-            } catch (Exception ignored) {
-            }
-        }
+        IoUtils.closeQuietly(client);
     }
 
     private class NotRespondingRunnable implements Runnable {
index 4d8e734..562065e 100644 (file)
@@ -85,7 +85,7 @@ public class NanoAppFilter implements Parcelable {
         mAppId = in.readLong();
         mAppVersion = in.readInt();
         mVersionRestrictionMask = in.readInt();
-        mAppIdVendorMask = in.readInt();
+        mAppIdVendorMask = in.readLong();
     }
 
     public int describeContents() {
@@ -93,7 +93,6 @@ public class NanoAppFilter implements Parcelable {
     }
 
     public void writeToParcel(Parcel out, int flags) {
-
         out.writeLong(mAppId);
         out.writeInt(mAppVersion);
         out.writeInt(mVersionRestrictionMask);
index 88d6e84..9fccd1e 100644 (file)
@@ -53,32 +53,35 @@ import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.Objects;
+import java.util.concurrent.Executor;
 import java.util.concurrent.TimeUnit;
 import java.util.regex.Pattern;
 import java.util.zip.CRC32;
 import java.util.zip.CheckedInputStream;
 
 /**
- * Tools for managing files.  Not for public consumption.
- * @hide
+ * Utility methods useful for working with files.
  */
 public class FileUtils {
     private static final String TAG = "FileUtils";
 
-    public static final int S_IRWXU = 00700;
-    public static final int S_IRUSR = 00400;
-    public static final int S_IWUSR = 00200;
-    public static final int S_IXUSR = 00100;
+    /** {@hide} */ public static final int S_IRWXU = 00700;
+    /** {@hide} */ public static final int S_IRUSR = 00400;
+    /** {@hide} */ public static final int S_IWUSR = 00200;
+    /** {@hide} */ public static final int S_IXUSR = 00100;
 
-    public static final int S_IRWXG = 00070;
-    public static final int S_IRGRP = 00040;
-    public static final int S_IWGRP = 00020;
-    public static final int S_IXGRP = 00010;
+    /** {@hide} */ public static final int S_IRWXG = 00070;
+    /** {@hide} */ public static final int S_IRGRP = 00040;
+    /** {@hide} */ public static final int S_IWGRP = 00020;
+    /** {@hide} */ public static final int S_IXGRP = 00010;
 
-    public static final int S_IRWXO = 00007;
-    public static final int S_IROTH = 00004;
-    public static final int S_IWOTH = 00002;
-    public static final int S_IXOTH = 00001;
+    /** {@hide} */ public static final int S_IRWXO = 00007;
+    /** {@hide} */ public static final int S_IROTH = 00004;
+    /** {@hide} */ public static final int S_IWOTH = 00002;
+    /** {@hide} */ public static final int S_IXOTH = 00001;
+
+    private FileUtils() {
+    }
 
     /** Regular expression for safe filenames: no spaces or metacharacters.
       *
@@ -94,6 +97,9 @@ public class FileUtils {
 
     private static final long COPY_CHECKPOINT_BYTES = 524288;
 
+    /**
+     * Listener that is called periodically as progress is made.
+     */
     public interface ProgressListener {
         public void onProgress(long progress);
     }
@@ -105,6 +111,7 @@ public class FileUtils {
      * @param uid to apply through {@code chown}, or -1 to leave unchanged
      * @param gid to apply through {@code chown}, or -1 to leave unchanged
      * @return 0 on success, otherwise errno.
+     * @hide
      */
     public static int setPermissions(File path, int mode, int uid, int gid) {
         return setPermissions(path.getAbsolutePath(), mode, uid, gid);
@@ -117,6 +124,7 @@ public class FileUtils {
      * @param uid to apply through {@code chown}, or -1 to leave unchanged
      * @param gid to apply through {@code chown}, or -1 to leave unchanged
      * @return 0 on success, otherwise errno.
+     * @hide
      */
     public static int setPermissions(String path, int mode, int uid, int gid) {
         try {
@@ -145,6 +153,7 @@ public class FileUtils {
      * @param uid to apply through {@code chown}, or -1 to leave unchanged
      * @param gid to apply through {@code chown}, or -1 to leave unchanged
      * @return 0 on success, otherwise errno.
+     * @hide
      */
     public static int setPermissions(FileDescriptor fd, int mode, int uid, int gid) {
         try {
@@ -166,7 +175,14 @@ public class FileUtils {
         return 0;
     }
 
-    public static void copyPermissions(File from, File to) throws IOException {
+    /**
+     * Copy the owner UID, owner GID, and mode bits from one file to another.
+     *
+     * @param from File where attributes should be copied from.
+     * @param to File where attributes should be copied to.
+     * @hide
+     */
+    public static void copyPermissions(@NonNull File from, @NonNull File to) throws IOException {
         try {
             final StructStat stat = Os.stat(from.getAbsolutePath());
             Os.chmod(to.getAbsolutePath(), stat.st_mode);
@@ -177,8 +193,10 @@ public class FileUtils {
     }
 
     /**
-     * Return owning UID of given path, otherwise -1.
+     * @deprecated use {@link Os#stat(String)} instead.
+     * @hide
      */
+    @Deprecated
     public static int getUid(String path) {
         try {
             return Os.stat(path).st_uid;
@@ -190,6 +208,8 @@ public class FileUtils {
     /**
      * Perform an fsync on the given FileOutputStream.  The stream at this
      * point must be flushed but not yet closed.
+     *
+     * @hide
      */
     public static boolean sync(FileOutputStream stream) {
         try {
@@ -204,6 +224,7 @@ public class FileUtils {
 
     /**
      * @deprecated use {@link #copy(File, File)} instead.
+     * @hide
      */
     @Deprecated
     public static boolean copyFile(File srcFile, File destFile) {
@@ -217,6 +238,7 @@ public class FileUtils {
 
     /**
      * @deprecated use {@link #copy(File, File)} instead.
+     * @hide
      */
     @Deprecated
     public static void copyFileOrThrow(File srcFile, File destFile) throws IOException {
@@ -227,6 +249,7 @@ public class FileUtils {
 
     /**
      * @deprecated use {@link #copy(InputStream, OutputStream)} instead.
+     * @hide
      */
     @Deprecated
     public static boolean copyToFile(InputStream inputStream, File destFile) {
@@ -240,6 +263,7 @@ public class FileUtils {
 
     /**
      * @deprecated use {@link #copy(InputStream, OutputStream)} instead.
+     * @hide
      */
     @Deprecated
     public static void copyToFileOrThrow(InputStream in, File destFile) throws IOException {
@@ -265,7 +289,7 @@ public class FileUtils {
      * @return number of bytes copied.
      */
     public static long copy(@NonNull File from, @NonNull File to) throws IOException {
-        return copy(from, to, null, null);
+        return copy(from, to, null, null, null);
     }
 
     /**
@@ -274,16 +298,17 @@ public class FileUtils {
      * Attempts to use several optimization strategies to copy the data in the
      * kernel before falling back to a userspace copy as a last resort.
      *
-     * @param listener to be periodically notified as the copy progresses.
      * @param signal to signal if the copy should be cancelled early.
+     * @param executor that listener events should be delivered via.
+     * @param listener to be periodically notified as the copy progresses.
      * @return number of bytes copied.
      */
     public static long copy(@NonNull File from, @NonNull File to,
-            @Nullable ProgressListener listener, @Nullable CancellationSignal signal)
-            throws IOException {
+            @Nullable CancellationSignal signal, @Nullable Executor executor,
+            @Nullable ProgressListener listener) throws IOException {
         try (FileInputStream in = new FileInputStream(from);
                 FileOutputStream out = new FileOutputStream(to)) {
-            return copy(in, out, listener, signal);
+            return copy(in, out, signal, executor, listener);
         }
     }
 
@@ -296,7 +321,7 @@ public class FileUtils {
      * @return number of bytes copied.
      */
     public static long copy(@NonNull InputStream in, @NonNull OutputStream out) throws IOException {
-        return copy(in, out, null, null);
+        return copy(in, out, null, null, null);
     }
 
     /**
@@ -305,22 +330,23 @@ public class FileUtils {
      * Attempts to use several optimization strategies to copy the data in the
      * kernel before falling back to a userspace copy as a last resort.
      *
-     * @param listener to be periodically notified as the copy progresses.
      * @param signal to signal if the copy should be cancelled early.
+     * @param executor that listener events should be delivered via.
+     * @param listener to be periodically notified as the copy progresses.
      * @return number of bytes copied.
      */
     public static long copy(@NonNull InputStream in, @NonNull OutputStream out,
-            @Nullable ProgressListener listener, @Nullable CancellationSignal signal)
-            throws IOException {
+            @Nullable CancellationSignal signal, @Nullable Executor executor,
+            @Nullable ProgressListener listener) throws IOException {
         if (ENABLE_COPY_OPTIMIZATIONS) {
             if (in instanceof FileInputStream && out instanceof FileOutputStream) {
                 return copy(((FileInputStream) in).getFD(), ((FileOutputStream) out).getFD(),
-                        listener, signal);
+                        signal, executor, listener);
             }
         }
 
         // Worse case fallback to userspace
-        return copyInternalUserspace(in, out, listener, signal);
+        return copyInternalUserspace(in, out, signal, executor, listener);
     }
 
     /**
@@ -333,7 +359,7 @@ public class FileUtils {
      */
     public static long copy(@NonNull FileDescriptor in, @NonNull FileDescriptor out)
             throws IOException {
-        return copy(in, out, null, null);
+        return copy(in, out, null, null, null);
     }
 
     /**
@@ -342,14 +368,15 @@ public class FileUtils {
      * Attempts to use several optimization strategies to copy the data in the
      * kernel before falling back to a userspace copy as a last resort.
      *
-     * @param listener to be periodically notified as the copy progresses.
      * @param signal to signal if the copy should be cancelled early.
+     * @param executor that listener events should be delivered via.
+     * @param listener to be periodically notified as the copy progresses.
      * @return number of bytes copied.
      */
     public static long copy(@NonNull FileDescriptor in, @NonNull FileDescriptor out,
-            @Nullable ProgressListener listener, @Nullable CancellationSignal signal)
-            throws IOException {
-        return copy(in, out, listener, signal, Long.MAX_VALUE);
+            @Nullable CancellationSignal signal, @Nullable Executor executor,
+            @Nullable ProgressListener listener) throws IOException {
+        return copy(in, out, Long.MAX_VALUE, signal, executor, listener);
     }
 
     /**
@@ -358,22 +385,24 @@ public class FileUtils {
      * Attempts to use several optimization strategies to copy the data in the
      * kernel before falling back to a userspace copy as a last resort.
      *
-     * @param listener to be periodically notified as the copy progresses.
-     * @param signal to signal if the copy should be cancelled early.
      * @param count the number of bytes to copy.
+     * @param signal to signal if the copy should be cancelled early.
+     * @param executor that listener events should be delivered via.
+     * @param listener to be periodically notified as the copy progresses.
      * @return number of bytes copied.
+     * @hide
      */
-    public static long copy(@NonNull FileDescriptor in, @NonNull FileDescriptor out,
-            @Nullable ProgressListener listener, @Nullable CancellationSignal signal, long count)
-            throws IOException {
+    public static long copy(@NonNull FileDescriptor in, @NonNull FileDescriptor out, long count,
+            @Nullable CancellationSignal signal, @Nullable Executor executor,
+            @Nullable ProgressListener listener) throws IOException {
         if (ENABLE_COPY_OPTIMIZATIONS) {
             try {
                 final StructStat st_in = Os.fstat(in);
                 final StructStat st_out = Os.fstat(out);
                 if (S_ISREG(st_in.st_mode) && S_ISREG(st_out.st_mode)) {
-                    return copyInternalSendfile(in, out, listener, signal, count);
+                    return copyInternalSendfile(in, out, count, signal, executor, listener);
                 } else if (S_ISFIFO(st_in.st_mode) || S_ISFIFO(st_out.st_mode)) {
-                    return copyInternalSplice(in, out, listener, signal, count);
+                    return copyInternalSplice(in, out, count, signal, executor, listener);
                 }
             } catch (ErrnoException e) {
                 throw e.rethrowAsIOException();
@@ -381,15 +410,17 @@ public class FileUtils {
         }
 
         // Worse case fallback to userspace
-        return copyInternalUserspace(in, out, listener, signal, count);
+        return copyInternalUserspace(in, out, count, signal, executor, listener);
     }
 
     /**
      * Requires one of input or output to be a pipe.
+     *
+     * @hide
      */
     @VisibleForTesting
-    public static long copyInternalSplice(FileDescriptor in, FileDescriptor out,
-            ProgressListener listener, CancellationSignal signal, long count)
+    public static long copyInternalSplice(FileDescriptor in, FileDescriptor out, long count,
+            CancellationSignal signal, Executor executor, ProgressListener listener)
             throws ErrnoException {
         long progress = 0;
         long checkpoint = 0;
@@ -405,24 +436,32 @@ public class FileUtils {
                 if (signal != null) {
                     signal.throwIfCanceled();
                 }
-                if (listener != null) {
-                    listener.onProgress(progress);
+                if (executor != null && listener != null) {
+                    final long progressSnapshot = progress;
+                    executor.execute(() -> {
+                        listener.onProgress(progressSnapshot);
+                    });
                 }
                 checkpoint = 0;
             }
         }
-        if (listener != null) {
-            listener.onProgress(progress);
+        if (executor != null && listener != null) {
+            final long progressSnapshot = progress;
+            executor.execute(() -> {
+                listener.onProgress(progressSnapshot);
+            });
         }
         return progress;
     }
 
     /**
      * Requires both input and output to be a regular file.
+     *
+     * @hide
      */
     @VisibleForTesting
-    public static long copyInternalSendfile(FileDescriptor in, FileDescriptor out,
-            ProgressListener listener, CancellationSignal signal, long count)
+    public static long copyInternalSendfile(FileDescriptor in, FileDescriptor out, long count,
+            CancellationSignal signal, Executor executor, ProgressListener listener)
             throws ErrnoException {
         long progress = 0;
         long checkpoint = 0;
@@ -437,33 +476,52 @@ public class FileUtils {
                 if (signal != null) {
                     signal.throwIfCanceled();
                 }
-                if (listener != null) {
-                    listener.onProgress(progress);
+                if (executor != null && listener != null) {
+                    final long progressSnapshot = progress;
+                    executor.execute(() -> {
+                        listener.onProgress(progressSnapshot);
+                    });
                 }
                 checkpoint = 0;
             }
         }
-        if (listener != null) {
-            listener.onProgress(progress);
+        if (executor != null && listener != null) {
+            final long progressSnapshot = progress;
+            executor.execute(() -> {
+                listener.onProgress(progressSnapshot);
+            });
         }
         return progress;
     }
 
+    /** {@hide} */
+    @Deprecated
     @VisibleForTesting
     public static long copyInternalUserspace(FileDescriptor in, FileDescriptor out,
-            ProgressListener listener, CancellationSignal signal, long count) throws IOException {
+            ProgressListener listener, CancellationSignal signal, long count)
+            throws IOException {
+        return copyInternalUserspace(in, out, count, signal, Runnable::run, listener);
+    }
+
+    /** {@hide} */
+    @VisibleForTesting
+    public static long copyInternalUserspace(FileDescriptor in, FileDescriptor out, long count,
+            CancellationSignal signal, Executor executor, ProgressListener listener)
+            throws IOException {
         if (count != Long.MAX_VALUE) {
             return copyInternalUserspace(new SizedInputStream(new FileInputStream(in), count),
-                    new FileOutputStream(out), listener, signal);
+                    new FileOutputStream(out), signal, executor, listener);
         } else {
             return copyInternalUserspace(new FileInputStream(in),
-                    new FileOutputStream(out), listener, signal);
+                    new FileOutputStream(out), signal, executor, listener);
         }
     }
 
+    /** {@hide} */
     @VisibleForTesting
     public static long copyInternalUserspace(InputStream in, OutputStream out,
-            ProgressListener listener, CancellationSignal signal) throws IOException {
+            CancellationSignal signal, Executor executor, ProgressListener listener)
+            throws IOException {
         long progress = 0;
         long checkpoint = 0;
         byte[] buffer = new byte[8192];
@@ -479,14 +537,20 @@ public class FileUtils {
                 if (signal != null) {
                     signal.throwIfCanceled();
                 }
-                if (listener != null) {
-                    listener.onProgress(progress);
+                if (executor != null && listener != null) {
+                    final long progressSnapshot = progress;
+                    executor.execute(() -> {
+                        listener.onProgress(progressSnapshot);
+                    });
                 }
                 checkpoint = 0;
             }
         }
-        if (listener != null) {
-            listener.onProgress(progress);
+        if (executor != null && listener != null) {
+            final long progressSnapshot = progress;
+            executor.execute(() -> {
+                listener.onProgress(progressSnapshot);
+            });
         }
         return progress;
     }
@@ -494,6 +558,7 @@ public class FileUtils {
     /**
      * Check if a filename is "safe" (no metacharacters or spaces).
      * @param file  The file to check
+     * @hide
      */
     public static boolean isFilenameSafe(File file) {
         // Note, we check whether it matches what's known to be safe,
@@ -509,6 +574,7 @@ public class FileUtils {
      * @param ellipsis to add of the file was truncated (can be null)
      * @return the contents of the file, possibly truncated
      * @throws IOException if something goes wrong reading the file
+     * @hide
      */
     public static String readTextFile(File file, int max, String ellipsis) throws IOException {
         InputStream input = new FileInputStream(file);
@@ -563,13 +629,16 @@ public class FileUtils {
         }
     }
 
+    /** {@hide} */
     public static void stringToFile(File file, String string) throws IOException {
         stringToFile(file.getAbsolutePath(), string);
     }
 
-    /*
+    /**
      * Writes the bytes given in {@code content} to the file whose absolute path
      * is {@code filename}.
+     *
+     * @hide
      */
     public static void bytesToFile(String filename, byte[] content) throws IOException {
         if (filename.startsWith("/proc/")) {
@@ -592,18 +661,23 @@ public class FileUtils {
      * @param filename
      * @param string
      * @throws IOException
+     * @hide
      */
     public static void stringToFile(String filename, String string) throws IOException {
         bytesToFile(filename, string.getBytes(StandardCharsets.UTF_8));
     }
 
     /**
-     * Computes the checksum of a file using the CRC32 checksum routine.
-     * The value of the checksum is returned.
+     * Computes the checksum of a file using the CRC32 checksum routine. The
+     * value of the checksum is returned.
      *
-     * @param file  the file to checksum, must not be null
+     * @param file the file to checksum, must not be null
      * @return the checksum value or an exception is thrown.
+     * @deprecated this is a weak hashing algorithm, and should not be used due
+     *             to its potential for collision.
+     * @hide
      */
+    @Deprecated
     public static long checksumCrc32(File file) throws FileNotFoundException, IOException {
         CRC32 checkSummer = new CRC32();
         CheckedInputStream cis = null;
@@ -632,6 +706,7 @@ public class FileUtils {
      * @param minCount Always keep at least this many files.
      * @param minAgeMs Always keep files younger than this age, in milliseconds.
      * @return if any files were deleted.
+     * @hide
      */
     public static boolean deleteOlderFiles(File dir, int minCount, long minAgeMs) {
         if (minCount < 0 || minAgeMs < 0) {
@@ -673,6 +748,8 @@ public class FileUtils {
      * Both files <em>must</em> have been resolved using
      * {@link File#getCanonicalFile()} to avoid symlink or path traversal
      * attacks.
+     *
+     * @hide
      */
     public static boolean contains(File[] dirs, File file) {
         for (File dir : dirs) {
@@ -690,12 +767,15 @@ public class FileUtils {
      * Both files <em>must</em> have been resolved using
      * {@link File#getCanonicalFile()} to avoid symlink or path traversal
      * attacks.
+     *
+     * @hide
      */
     public static boolean contains(File dir, File file) {
         if (dir == null || file == null) return false;
         return contains(dir.getAbsolutePath(), file.getAbsolutePath());
     }
 
+    /** {@hide} */
     public static boolean contains(String dirPath, String filePath) {
         if (dirPath.equals(filePath)) {
             return true;
@@ -706,6 +786,7 @@ public class FileUtils {
         return filePath.startsWith(dirPath);
     }
 
+    /** {@hide} */
     public static boolean deleteContentsAndDir(File dir) {
         if (deleteContents(dir)) {
             return dir.delete();
@@ -714,6 +795,7 @@ public class FileUtils {
         }
     }
 
+    /** {@hide} */
     public static boolean deleteContents(File dir) {
         File[] files = dir.listFiles();
         boolean success = true;
@@ -743,6 +825,8 @@ public class FileUtils {
 
     /**
      * Check if given filename is valid for an ext4 filesystem.
+     *
+     * @hide
      */
     public static boolean isValidExtFilename(String name) {
         return (name != null) && name.equals(buildValidExtFilename(name));
@@ -751,6 +835,8 @@ public class FileUtils {
     /**
      * Mutate the given filename to make it valid for an ext4 filesystem,
      * replacing any invalid characters with "_".
+     *
+     * @hide
      */
     public static String buildValidExtFilename(String name) {
         if (TextUtils.isEmpty(name) || ".".equals(name) || "..".equals(name)) {
@@ -792,6 +878,8 @@ public class FileUtils {
 
     /**
      * Check if given filename is valid for a FAT filesystem.
+     *
+     * @hide
      */
     public static boolean isValidFatFilename(String name) {
         return (name != null) && name.equals(buildValidFatFilename(name));
@@ -800,6 +888,8 @@ public class FileUtils {
     /**
      * Mutate the given filename to make it valid for a FAT filesystem,
      * replacing any invalid characters with "_".
+     *
+     * @hide
      */
     public static String buildValidFatFilename(String name) {
         if (TextUtils.isEmpty(name) || ".".equals(name) || "..".equals(name)) {
@@ -820,6 +910,7 @@ public class FileUtils {
         return res.toString();
     }
 
+    /** {@hide} */
     @VisibleForTesting
     public static String trimFilename(String str, int maxBytes) {
         final StringBuilder res = new StringBuilder(str);
@@ -827,6 +918,7 @@ public class FileUtils {
         return res.toString();
     }
 
+    /** {@hide} */
     private static void trimFilename(StringBuilder res, int maxBytes) {
         byte[] raw = res.toString().getBytes(StandardCharsets.UTF_8);
         if (raw.length > maxBytes) {
@@ -839,12 +931,14 @@ public class FileUtils {
         }
     }
 
+    /** {@hide} */
     public static String rewriteAfterRename(File beforeDir, File afterDir, String path) {
         if (path == null) return null;
         final File result = rewriteAfterRename(beforeDir, afterDir, new File(path));
         return (result != null) ? result.getAbsolutePath() : null;
     }
 
+    /** {@hide} */
     public static String[] rewriteAfterRename(File beforeDir, File afterDir, String[] paths) {
         if (paths == null) return null;
         final String[] result = new String[paths.length];
@@ -858,6 +952,8 @@ public class FileUtils {
      * Given a path under the "before" directory, rewrite it to live under the
      * "after" directory. For example, {@code /before/foo/bar.txt} would become
      * {@code /after/foo/bar.txt}.
+     *
+     * @hide
      */
     public static File rewriteAfterRename(File beforeDir, File afterDir, File file) {
         if (file == null || beforeDir == null || afterDir == null) return null;
@@ -869,6 +965,7 @@ public class FileUtils {
         return null;
     }
 
+    /** {@hide} */
     private static File buildUniqueFileWithExtension(File parent, String name, String ext)
             throws FileNotFoundException {
         File file = buildFile(parent, name, ext);
@@ -895,6 +992,7 @@ public class FileUtils {
      * 'example.txt' or 'example (1).txt', etc.
      *
      * @throws FileNotFoundException
+     * @hide
      */
     public static File buildUniqueFile(File parent, String mimeType, String displayName)
             throws FileNotFoundException {
@@ -905,6 +1003,8 @@ public class FileUtils {
     /**
      * Generates a unique file name under the given parent directory, keeping
      * any extension intact.
+     *
+     * @hide
      */
     public static File buildUniqueFile(File parent, String displayName)
             throws FileNotFoundException {
@@ -929,6 +1029,8 @@ public class FileUtils {
      * If the display name doesn't have an extension that matches the requested MIME type, the
      * extension is regarded as a part of filename and default extension for that MIME type is
      * appended.
+     *
+     * @hide
      */
     public static String[] splitFileName(String mimeType, String displayName) {
         String name;
@@ -975,6 +1077,7 @@ public class FileUtils {
         return new String[] { name, ext };
     }
 
+    /** {@hide} */
     private static File buildFile(File parent, String name, String ext) {
         if (TextUtils.isEmpty(ext)) {
             return new File(parent, name);
@@ -983,6 +1086,7 @@ public class FileUtils {
         }
     }
 
+    /** {@hide} */
     public static @NonNull String[] listOrEmpty(@Nullable File dir) {
         if (dir == null) return EmptyArray.STRING;
         final String[] res = dir.list();
@@ -993,6 +1097,7 @@ public class FileUtils {
         }
     }
 
+    /** {@hide} */
     public static @NonNull File[] listFilesOrEmpty(@Nullable File dir) {
         if (dir == null) return EMPTY;
         final File[] res = dir.listFiles();
@@ -1003,6 +1108,7 @@ public class FileUtils {
         }
     }
 
+    /** {@hide} */
     public static @NonNull File[] listFilesOrEmpty(@Nullable File dir, FilenameFilter filter) {
         if (dir == null) return EMPTY;
         final File[] res = dir.listFiles(filter);
@@ -1013,6 +1119,7 @@ public class FileUtils {
         }
     }
 
+    /** {@hide} */
     public static @Nullable File newFileOrNull(@Nullable String path) {
         return (path != null) ? new File(path) : null;
     }
@@ -1021,6 +1128,8 @@ public class FileUtils {
      * Creates a directory with name {@code name} under an existing directory {@code baseDir}.
      * Returns a {@code File} object representing the directory on success, {@code null} on
      * failure.
+     *
+     * @hide
      */
     public static @Nullable File createDir(File baseDir, String name) {
         final File dir = new File(baseDir, name);
@@ -1036,6 +1145,8 @@ public class FileUtils {
      * Round the given size of a storage device to a nice round power-of-two
      * value, such as 256MB or 32GB. This avoids showing weird values like
      * "29.5GB" in UI.
+     *
+     * @hide
      */
     public static long roundStorageSize(long size) {
         long val = 1;
@@ -1050,6 +1161,23 @@ public class FileUtils {
         return val * pow;
     }
 
+    /**
+     * Closes the given object quietly, ignoring any checked exceptions. Does
+     * nothing if the given object is {@code null}.
+     */
+    public static void closeQuietly(@Nullable AutoCloseable closeable) {
+        IoUtils.closeQuietly(closeable);
+    }
+
+    /**
+     * Closes the given object quietly, ignoring any checked exceptions. Does
+     * nothing if the given object is {@code null}.
+     */
+    public static void closeQuietly(@Nullable FileDescriptor fd) {
+        IoUtils.closeQuietly(fd);
+    }
+
+    /** {@hide} */
     @VisibleForTesting
     public static class MemoryPipe extends Thread implements AutoCloseable {
         private final FileDescriptor[] pipe;
index a5f9305..eb4b315 100644 (file)
@@ -118,7 +118,7 @@ public class PrintFileDocumentAdapter extends PrintDocumentAdapter {
         protected Void doInBackground(Void... params) {
             try (InputStream in = new FileInputStream(mFile);
                     OutputStream out = new FileOutputStream(mDestination.getFileDescriptor())) {
-                FileUtils.copy(in, out, null, mCancellationSignal);
+                FileUtils.copy(in, out, mCancellationSignal, null, null);
             } catch (OperationCanceledException e) {
                 // Ignored; already handled below
             } catch (IOException e) {
index a80dced..f97c64c 100644 (file)
@@ -100,7 +100,8 @@ public final class DocumentsContract {
     public static final String PROVIDER_INTERFACE = "android.content.action.DOCUMENTS_PROVIDER";
 
     /** {@hide} */
-    public static final String EXTRA_PACKAGE_NAME = "android.content.extra.PACKAGE_NAME";
+    @Deprecated
+    public static final String EXTRA_PACKAGE_NAME = Intent.EXTRA_PACKAGE_NAME;
 
     /** {@hide} */
     public static final String EXTRA_SHOW_ADVANCED = "android.content.extra.SHOW_ADVANCED";
index 041e8a8..e3b8fec 100644 (file)
 
 package android.util;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.UnsupportedEncodingException;
-import org.apache.harmony.xml.ExpatReader;
-import org.kxml2.io.KXmlParser;
+import libcore.util.XmlObjectFactory;
+
 import org.xml.sax.ContentHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.XMLReader;
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
-import org.xmlpull.v1.XmlPullParserFactory;
 import org.xmlpull.v1.XmlSerializer;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+
 /**
  * XML utility methods.
  */
 public class Xml {
-    /** @hide */ public Xml() {}
+    private Xml() {}
 
     /**
      * {@link org.xmlpull.v1.XmlPullParser} "relaxed" feature name.
@@ -52,7 +52,7 @@ public class Xml {
     public static void parse(String xml, ContentHandler contentHandler)
             throws SAXException {
         try {
-            XMLReader reader = new ExpatReader();
+            XMLReader reader = XmlObjectFactory.newXMLReader();
             reader.setContentHandler(contentHandler);
             reader.parse(new InputSource(new StringReader(xml)));
         } catch (IOException e) {
@@ -66,7 +66,7 @@ public class Xml {
      */
     public static void parse(Reader in, ContentHandler contentHandler)
             throws IOException, SAXException {
-        XMLReader reader = new ExpatReader();
+        XMLReader reader = XmlObjectFactory.newXMLReader();
         reader.setContentHandler(contentHandler);
         reader.parse(new InputSource(in));
     }
@@ -77,7 +77,7 @@ public class Xml {
      */
     public static void parse(InputStream in, Encoding encoding,
             ContentHandler contentHandler) throws IOException, SAXException {
-        XMLReader reader = new ExpatReader();
+        XMLReader reader = XmlObjectFactory.newXMLReader();
         reader.setContentHandler(contentHandler);
         InputSource source = new InputSource(in);
         source.setEncoding(encoding.expatName);
@@ -89,7 +89,7 @@ public class Xml {
      */
     public static XmlPullParser newPullParser() {
         try {
-            KXmlParser parser = new KXmlParser();
+            XmlPullParser parser = XmlObjectFactory.newXmlPullParser();
             parser.setFeature(XmlPullParser.FEATURE_PROCESS_DOCDECL, true);
             parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
             return parser;
@@ -102,25 +102,7 @@ public class Xml {
      * Creates a new xml serializer.
      */
     public static XmlSerializer newSerializer() {
-        try {
-            return XmlSerializerFactory.instance.newSerializer();
-        } catch (XmlPullParserException e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    /** Factory for xml serializers. Initialized on demand. */
-    static class XmlSerializerFactory {
-        static final String TYPE
-                = "org.kxml2.io.KXmlParser,org.kxml2.io.KXmlSerializer";
-        static final XmlPullParserFactory instance;
-        static {
-            try {
-                instance = XmlPullParserFactory.newInstance(TYPE, null);
-            } catch (XmlPullParserException e) {
-                throw new AssertionError(e);
-            }
-        }
+        return XmlObjectFactory.newXmlSerializer();
     }
 
     /**
index 19e95b8..e2e2b00 100644 (file)
@@ -7547,7 +7547,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
      */
     public void onPopulateAccessibilityEventInternal(AccessibilityEvent event) {
         if ((event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED)
-                && !TextUtils.isEmpty(getAccessibilityPaneTitle())) {
+                && isAccessibilityPane()) {
             event.getText().add(getAccessibilityPaneTitle());
         }
     }
@@ -12963,7 +12963,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                 }
             }
         }
-        if (!TextUtils.isEmpty(getAccessibilityPaneTitle())) {
+        if (isAccessibilityPane()) {
             if (isVisible != oldVisible) {
                 notifyViewAccessibilityStateChangedIfNeeded(isVisible
                         ? AccessibilityEvent.CONTENT_CHANGE_TYPE_PANE_APPEARED
index 94ee021..b675698 100644 (file)
@@ -220,7 +220,6 @@ cc_library_shared {
         "external/skia/src/image",
         "external/skia/src/images",
         "frameworks/base/media/jni",
-        "libcore/include",
         "system/media/camera/include",
         "system/media/private/camera/include",
     ],
index 41a81ac..9eb6f8d 100644 (file)
@@ -17,7 +17,6 @@
 #define LOG_TAG "MeasuredParagraph"
 
 #include "GraphicsJNI.h"
-#include "ScopedIcuLocale.h"
 #include "unicode/locid.h"
 #include "unicode/brkiter.h"
 #include "utils/misc.h"
index ad84858..fec5b69 100644 (file)
@@ -16,7 +16,6 @@
 
 #define LOG_TAG "StaticLayout"
 
-#include "ScopedIcuLocale.h"
 #include "unicode/locid.h"
 #include "unicode/brkiter.h"
 #include "utils/misc.h"
diff --git a/core/res/res/values-mcc334-mnc03/config.xml b/core/res/res/values-mcc334-mnc03/config.xml
new file mode 100644 (file)
index 0000000..c0d2b35
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Show area update info settings in CellBroadcastReceiver and information in SIM status in Settings app -->
+    <bool name="config_showAreaUpdateInfoSettings">true</bool>
+</resources>
diff --git a/core/res/res/values-mcc334-mnc030/config.xml b/core/res/res/values-mcc334-mnc030/config.xml
new file mode 100644 (file)
index 0000000..c0d2b35
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Show area update info settings in CellBroadcastReceiver and information in SIM status in Settings app -->
+    <bool name="config_showAreaUpdateInfoSettings">true</bool>
+</resources>
diff --git a/core/res/res/values-mcc704-mnc03/config.xml b/core/res/res/values-mcc704-mnc03/config.xml
new file mode 100644 (file)
index 0000000..c0d2b35
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Show area update info settings in CellBroadcastReceiver and information in SIM status in Settings app -->
+    <bool name="config_showAreaUpdateInfoSettings">true</bool>
+</resources>
diff --git a/core/res/res/values-mcc706-mnc04/config.xml b/core/res/res/values-mcc706-mnc04/config.xml
new file mode 100644 (file)
index 0000000..c0d2b35
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Show area update info settings in CellBroadcastReceiver and information in SIM status in Settings app -->
+    <bool name="config_showAreaUpdateInfoSettings">true</bool>
+</resources>
diff --git a/core/res/res/values-mcc712-mnc04/config.xml b/core/res/res/values-mcc712-mnc04/config.xml
new file mode 100644 (file)
index 0000000..c0d2b35
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Show area update info settings in CellBroadcastReceiver and information in SIM status in Settings app -->
+    <bool name="config_showAreaUpdateInfoSettings">true</bool>
+</resources>
diff --git a/core/res/res/values-mcc716-mnc06/config.xml b/core/res/res/values-mcc716-mnc06/config.xml
new file mode 100644 (file)
index 0000000..c0d2b35
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Show area update info settings in CellBroadcastReceiver and information in SIM status in Settings app -->
+    <bool name="config_showAreaUpdateInfoSettings">true</bool>
+</resources>
diff --git a/core/res/res/values-mcc716-mnc10/config.xml b/core/res/res/values-mcc716-mnc10/config.xml
new file mode 100644 (file)
index 0000000..c0d2b35
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Show area update info settings in CellBroadcastReceiver and information in SIM status in Settings app -->
+    <bool name="config_showAreaUpdateInfoSettings">true</bool>
+</resources>
diff --git a/core/res/res/values-mcc716-mnc17/config.xml b/core/res/res/values-mcc716-mnc17/config.xml
new file mode 100644 (file)
index 0000000..c0d2b35
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Show area update info settings in CellBroadcastReceiver and information in SIM status in Settings app -->
+    <bool name="config_showAreaUpdateInfoSettings">true</bool>
+</resources>
diff --git a/core/res/res/values-mcc722-mnc07/config.xml b/core/res/res/values-mcc722-mnc07/config.xml
new file mode 100644 (file)
index 0000000..c0d2b35
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Show area update info settings in CellBroadcastReceiver and information in SIM status in Settings app -->
+    <bool name="config_showAreaUpdateInfoSettings">true</bool>
+</resources>
diff --git a/core/res/res/values-mcc732-mnc123/config.xml b/core/res/res/values-mcc732-mnc123/config.xml
new file mode 100644 (file)
index 0000000..c0d2b35
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Show area update info settings in CellBroadcastReceiver and information in SIM status in Settings app -->
+    <bool name="config_showAreaUpdateInfoSettings">true</bool>
+</resources>
diff --git a/core/res/res/values-mcc740-mnc00/config.xml b/core/res/res/values-mcc740-mnc00/config.xml
new file mode 100644 (file)
index 0000000..c0d2b35
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- Show area update info settings in CellBroadcastReceiver and information in SIM status in Settings app -->
+    <bool name="config_showAreaUpdateInfoSettings">true</bool>
+</resources>
index 5989da7..c70fc3c 100644 (file)
@@ -54,7 +54,7 @@ public class FileUtilsBenchmark {
         for (int i = 0; i < reps; i++) {
             try (FileInputStream in = new FileInputStream(mSrc);
                     FileOutputStream out = new FileOutputStream(mDest)) {
-                copyInternalUserspace(in.getFD(), out.getFD(), null, null, Long.MAX_VALUE);
+                copyInternalUserspace(in.getFD(), out.getFD(), Long.MAX_VALUE, null, null, null);
             }
         }
     }
@@ -63,7 +63,7 @@ public class FileUtilsBenchmark {
         for (int i = 0; i < reps; i++) {
             try (FileInputStream in = new FileInputStream(mSrc);
                     FileOutputStream out = new FileOutputStream(mDest)) {
-                copyInternalSendfile(in.getFD(), out.getFD(), null, null, Long.MAX_VALUE);
+                copyInternalSendfile(in.getFD(), out.getFD(), Long.MAX_VALUE, null, null, null);
             }
         }
     }
@@ -72,7 +72,7 @@ public class FileUtilsBenchmark {
         for (int i = 0; i < reps; i++) {
             try (MemoryPipe in = MemoryPipe.createSource(mData);
                     FileOutputStream out = new FileOutputStream(mDest)) {
-                copyInternalUserspace(in.getFD(), out.getFD(), null, null, Long.MAX_VALUE);
+                copyInternalUserspace(in.getFD(), out.getFD(), Long.MAX_VALUE, null, null, null);
             }
         }
     }
@@ -81,7 +81,7 @@ public class FileUtilsBenchmark {
         for (int i = 0; i < reps; i++) {
             try (MemoryPipe in = MemoryPipe.createSource(mData);
                     FileOutputStream out = new FileOutputStream(mDest)) {
-                copyInternalSplice(in.getFD(), out.getFD(), null, null, Long.MAX_VALUE);
+                copyInternalSplice(in.getFD(), out.getFD(), Long.MAX_VALUE, null, null, null);
             }
         }
     }
@@ -90,7 +90,7 @@ public class FileUtilsBenchmark {
         for (int i = 0; i < reps; i++) {
             try (FileInputStream in = new FileInputStream(mSrc);
                     MemoryPipe out = MemoryPipe.createSink(mData)) {
-                copyInternalUserspace(in.getFD(), out.getFD(), null, null, Long.MAX_VALUE);
+                copyInternalUserspace(in.getFD(), out.getFD(), Long.MAX_VALUE, null, null, null);
             }
         }
     }
@@ -99,7 +99,7 @@ public class FileUtilsBenchmark {
         for (int i = 0; i < reps; i++) {
             try (FileInputStream in = new FileInputStream(mSrc);
                     MemoryPipe out = MemoryPipe.createSink(mData)) {
-                copyInternalSplice(in.getFD(), out.getFD(), null, null, Long.MAX_VALUE);
+                copyInternalSplice(in.getFD(), out.getFD(), Long.MAX_VALUE, null, null, null);
             }
         }
     }
index 0bc3a2d..9c9f11b 100644 (file)
@@ -193,7 +193,7 @@ public class FileUtilsTest {
 
             try (MemoryPipe in = MemoryPipe.createSource(source);
                     FileOutputStream out = new FileOutputStream(dest)) {
-                FileUtils.copy(in.getFD(), out.getFD(), null, null, size);
+                FileUtils.copy(in.getFD(), out.getFD(), size, null, null, null);
             }
 
             actual = readFile(dest);
index 111094b..59760ab 100644 (file)
@@ -48,6 +48,11 @@ cc_defaults {
         device_uses_hwc2: {
             cflags: ["-DUSE_HWC2"],
         },
+        eng: {
+            lto: {
+                never: true,
+            },
+        },
     },
 }
 
index fdd6a9c..a539b1f 100644 (file)
@@ -19,7 +19,9 @@ package android.ext.services.notification;
 import static android.app.NotificationManager.IMPORTANCE_MIN;
 import static android.service.notification.NotificationListenerService.Ranking.USER_SENTIMENT_NEGATIVE;
 
+import android.annotation.NonNull;
 import android.app.INotificationManager;
+import android.app.Notification;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.database.ContentObserver;
@@ -80,6 +82,7 @@ public class Assistant extends NotificationAssistantService {
 
     private float mDismissToViewRatioLimit;
     private int mStreakLimit;
+    private SmartActionsHelper mSmartActionsHelper;
 
     // key : impressions tracker
     // TODO: prune deleted channels and apps
@@ -99,6 +102,7 @@ public class Assistant extends NotificationAssistantService {
         // Contexts are correctly hooked up by the creation step, which is required for the observer
         // to be hooked up/initialized.
         new SettingsObserver(mHandler);
+        mSmartActionsHelper = new SmartActionsHelper();
     }
 
     private void loadFile() {
@@ -187,7 +191,26 @@ public class Assistant extends NotificationAssistantService {
     @Override
     public Adjustment onNotificationEnqueued(StatusBarNotification sbn) {
         if (DEBUG) Log.i(TAG, "ENQUEUED " + sbn.getKey());
-        return null;
+        ArrayList<Notification.Action> actions =
+                mSmartActionsHelper.suggestActions(this, sbn);
+        if (actions.isEmpty()) {
+            return null;
+        }
+        return createEnqueuedNotificationAdjustment(sbn, actions);
+    }
+
+    /** A convenience helper for creating an adjustment for an SBN. */
+    private Adjustment createEnqueuedNotificationAdjustment(
+            @NonNull StatusBarNotification statusBarNotification,
+            @NonNull ArrayList<Notification.Action> smartActions) {
+        Bundle signals = new Bundle();
+        signals.putParcelableArrayList(Adjustment.KEY_SMART_ACTIONS, smartActions);
+        return new Adjustment(
+                statusBarNotification.getPackageName(),
+                statusBarNotification.getKey(),
+                signals,
+                "smart action" /* explanation */,
+                statusBarNotification.getUserId());
     }
 
     @Override
@@ -378,4 +401,4 @@ public class Assistant extends NotificationAssistantService {
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/packages/ExtServices/src/android/ext/services/notification/SmartActionsHelper.java b/packages/ExtServices/src/android/ext/services/notification/SmartActionsHelper.java
new file mode 100644 (file)
index 0000000..1754461
--- /dev/null
@@ -0,0 +1,202 @@
+/**
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.ext.services.notification;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.app.Notification;
+import android.app.RemoteAction;
+import android.content.Context;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.service.notification.StatusBarNotification;
+import android.text.TextUtils;
+import android.util.ArrayMap;
+import android.view.textclassifier.TextClassification;
+import android.view.textclassifier.TextClassificationManager;
+import android.view.textclassifier.TextClassifier;
+import android.view.textclassifier.TextLinks;
+
+import com.android.internal.util.Preconditions;
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+public class SmartActionsHelper {
+    private static final ArrayList<Notification.Action> EMPTY_LIST = new ArrayList<>();
+
+    // If a notification has any of these flags set, it's inelgibile for actions being added.
+    private static final int FLAG_MASK_INELGIBILE_FOR_ACTIONS =
+            Notification.FLAG_ONGOING_EVENT
+                    | Notification.FLAG_FOREGROUND_SERVICE
+                    | Notification.FLAG_GROUP_SUMMARY
+                    | Notification.FLAG_NO_CLEAR;
+    private static final int MAX_ACTION_EXTRACTION_TEXT_LENGTH = 400;
+    private static final int MAX_ACTIONS_PER_LINK = 1;
+    private static final int MAX_SMART_ACTIONS = Notification.MAX_ACTION_BUTTONS;
+
+    SmartActionsHelper() {}
+
+    /**
+     * Adds action adjustments based on the notification contents.
+     *
+     * TODO: Once we have a API in {@link TextClassificationManager} to predict smart actions
+     * from notification text / message, we can replace most of the code here by consuming that API.
+     */
+    @NonNull
+    ArrayList<Notification.Action> suggestActions(
+            @Nullable Context context, @NonNull StatusBarNotification sbn) {
+        if (!isEligibleForActionAdjustment(sbn)) {
+            return EMPTY_LIST;
+        }
+        if (context == null) {
+            return EMPTY_LIST;
+        }
+        TextClassificationManager tcm = context.getSystemService(TextClassificationManager.class);
+        if (tcm == null) {
+            return EMPTY_LIST;
+        }
+        Notification.Action[] actions = sbn.getNotification().actions;
+        int numOfExistingActions = actions == null ? 0: actions.length;
+        int maxSmartActions = MAX_SMART_ACTIONS - numOfExistingActions;
+        return suggestActionsFromText(
+                tcm,
+                getMostSalientActionText(sbn.getNotification()), maxSmartActions);
+    }
+
+    /**
+     * Returns whether a notification is eligible for action adjustments.
+     *
+     * <p>We exclude system notifications, those that get refreshed frequently, or ones that relate
+     * to fundamental phone functionality where any error would result in a very negative user
+     * experience.
+     */
+    private boolean isEligibleForActionAdjustment(@NonNull StatusBarNotification sbn) {
+        Notification notification = sbn.getNotification();
+        String pkg = sbn.getPackageName();
+        if (notification.actions != null
+                && notification.actions.length >= Notification.MAX_ACTION_BUTTONS) {
+            return false;
+        }
+        if (0 != (notification.flags & FLAG_MASK_INELGIBILE_FOR_ACTIONS)) {
+            return false;
+        }
+        if (TextUtils.isEmpty(pkg) || pkg.equals("android")) {
+            return false;
+        }
+        // For now, we are only interested in messages.
+        return Notification.CATEGORY_MESSAGE.equals(notification.category)
+                || Notification.MessagingStyle.class.equals(notification.getNotificationStyle());
+    }
+
+    /** Returns the text most salient for action extraction in a notification. */
+    @Nullable
+    private CharSequence getMostSalientActionText(@NonNull Notification notification) {
+        /* If it's messaging style, use the most recent message. */
+        Parcelable[] messages = notification.extras.getParcelableArray(Notification.EXTRA_MESSAGES);
+        if (messages != null && messages.length != 0) {
+            Bundle lastMessage = (Bundle) messages[messages.length - 1];
+            CharSequence lastMessageText =
+                    lastMessage.getCharSequence(Notification.MessagingStyle.Message.KEY_TEXT);
+            if (!TextUtils.isEmpty(lastMessageText)) {
+                return lastMessageText;
+            }
+        }
+
+        // Fall back to using the normal text.
+        return notification.extras.getCharSequence(Notification.EXTRA_TEXT);
+    }
+
+    /** Returns a list of actions to act on entities in a given piece of text. */
+    @NonNull
+    private ArrayList<Notification.Action> suggestActionsFromText(
+            @NonNull TextClassificationManager tcm, @Nullable CharSequence text,
+            int maxSmartActions) {
+        if (TextUtils.isEmpty(text)) {
+            return EMPTY_LIST;
+        }
+        TextClassifier textClassifier = tcm.getTextClassifier();
+
+        // We want to process only text visible to the user to avoid confusing suggestions, so we
+        // truncate the text to a reasonable length. This is particularly important for e.g.
+        // email apps that sometimes include the text for the entire thread.
+        text = text.subSequence(0, Math.min(text.length(), MAX_ACTION_EXTRACTION_TEXT_LENGTH));
+
+        // Extract all entities.
+        TextLinks.Request textLinksRequest = new TextLinks.Request.Builder(text)
+                .setEntityConfig(
+                        TextClassifier.EntityConfig.createWithHints(
+                                Collections.singletonList(
+                                        TextClassifier.HINT_TEXT_IS_NOT_EDITABLE)))
+                .build();
+        TextLinks links = textClassifier.generateLinks(textLinksRequest);
+        ArrayMap<String, Integer> entityTypeFrequency = getEntityTypeFrequency(links);
+
+        ArrayList<Notification.Action> actions = new ArrayList<>();
+        for (TextLinks.TextLink link : links.getLinks()) {
+            // Ignore any entity type for which we have too many entities. This is to handle the
+            // case where a notification contains e.g. a list of phone numbers. In such cases, the
+            // user likely wants to act on the whole list rather than an individual entity.
+            if (link.getEntityCount() == 0
+                    || entityTypeFrequency.get(link.getEntity(0)) != 1) {
+                continue;
+            }
+
+            // Generate the actions, and add the most prominent ones to the action bar.
+            TextClassification classification =
+                    textClassifier.classifyText(
+                            new TextClassification.Request.Builder(
+                                    text, link.getStart(), link.getEnd()).build());
+            int numOfActions = Math.min(
+                    MAX_ACTIONS_PER_LINK, classification.getActions().size());
+            for (int i = 0; i < numOfActions; ++i) {
+                RemoteAction action = classification.getActions().get(i);
+                actions.add(
+                        new Notification.Action.Builder(
+                                action.getIcon(),
+                                action.getTitle(),
+                                action.getActionIntent())
+                                .build());
+                // We have enough smart actions.
+                if (actions.size() >= maxSmartActions) {
+                    return actions;
+                }
+            }
+        }
+        return actions;
+    }
+
+    /**
+     * Given the links extracted from a piece of text, returns the frequency of each entity
+     * type.
+     */
+    @NonNull
+    private ArrayMap<String, Integer> getEntityTypeFrequency(@NonNull TextLinks links) {
+        ArrayMap<String, Integer> entityTypeCount = new ArrayMap<>();
+        for (TextLinks.TextLink link : links.getLinks()) {
+            if (link.getEntityCount() == 0) {
+                continue;
+            }
+            String entityType = link.getEntity(0);
+            if (entityTypeCount.containsKey(entityType)) {
+                entityTypeCount.put(entityType, entityTypeCount.get(entityType) + 1);
+            } else {
+                entityTypeCount.put(entityType, 1);
+            }
+        }
+        return entityTypeCount;
+    }
+}
index 06fbf9f..59f272f 100644 (file)
@@ -297,7 +297,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
                     + " cannot be null");
         }
 
-        mCallingPackageName = extras.getString(DocumentsContract.EXTRA_PACKAGE_NAME);
+        mCallingPackageName = extras.getString(Intent.EXTRA_PACKAGE_NAME);
 
         if (savedInstanceState == null) {
             MetricsLogger.action(this, MetricsEvent.PRINT_PREVIEW, mCallingPackageName);
@@ -715,7 +715,7 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
         Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
         intent.setType("application/pdf");
         intent.putExtra(Intent.EXTRA_TITLE, info.getName());
-        intent.putExtra(DocumentsContract.EXTRA_PACKAGE_NAME, mCallingPackageName);
+        intent.putExtra(Intent.EXTRA_PACKAGE_NAME, mCallingPackageName);
 
         try {
             startActivityForResult(intent, ACTIVITY_REQUEST_CREATE_FILE);
index 2488f55..50d9c17 100644 (file)
     <string name="enabled_by_admin" msgid="5302986023578399263">"Activada per l\'administrador"</string>
     <string name="disabled_by_admin" msgid="8505398946020816620">"Desactivada per l\'administrador"</string>
     <string name="disabled" msgid="9206776641295849915">"Desactivat"</string>
-    <string name="external_source_trusted" msgid="2707996266575928037">"Permeses"</string>
-    <string name="external_source_untrusted" msgid="2677442511837596726">"No permeses"</string>
+    <string name="external_source_trusted" msgid="2707996266575928037">"Amb permís"</string>
+    <string name="external_source_untrusted" msgid="2677442511837596726">"Sense permís"</string>
     <string name="install_other_apps" msgid="6986686991775883017">"Instal·lar aplicacions desconegudes"</string>
     <string name="home" msgid="3256884684164448244">"Pàgina d\'inici de configuració"</string>
   <string-array name="battery_labels">
index 3e2afed..ca6fe88 100644 (file)
     <string name="show_notification_channel_warnings_summary" msgid="5536803251863694895">"अनुप्रयोगले कुनै मान्य च्यानल बिना सूचना पोस्ट गर्दा स्क्रिनमा चेतावनी देखाउँछ"</string>
     <string name="force_allow_on_external" msgid="3215759785081916381">"बाह्यमा बल प्रयोगको अनुमति प्राप्त अनुप्रयोगहरू"</string>
     <string name="force_allow_on_external_summary" msgid="3640752408258034689">"म्यानिफेेस्टका मानहरूको ख्याल नगरी कुनै पनि अनुप्रयोगलाई बाह्य भण्डारणमा लेख्न सकिने खाले बनाउँछ"</string>
-    <string name="force_resizable_activities" msgid="8615764378147824985">"à¤\97तिविधिहरà¥\82 à¤°à¤¿à¤¸à¤¾à¤\87à¤\9c à¤\97रà¥\8dनà¤\95à¥\8b à¤²à¤¾à¤\97ि à¤¬à¤¾à¤§à¥\8dय à¤\97रà¥\8dनà¥\81हà¥\8bसà¥\8d"</string>
+    <string name="force_resizable_activities" msgid="8615764378147824985">"à¤\86à¤\95ार à¤¬à¤¦à¤²à¥\8dन à¤¯à¥\8bà¤\97à¥\8dय à¤¹à¥\81नà¥\87 à¤¬à¤¨à¤¾à¤\89न à¤\97तिविधिहरà¥\82लाà¤\88 à¤¬à¤¾à¤§à¥\8dयातà¥\8dमà¤\95 à¤¬à¤¨à¤¾à¤\89नà¥\81हà¥\8bसà¥\8d।"</string>
     <string name="force_resizable_activities_summary" msgid="6667493494706124459">"म्यानिफेेस्ट मानहरूको ख्याल नगरी, बहु-विन्डोको लागि सबै रिसाइज गर्न सकिने गतिविधिहरू बनाउनुहोस्।"</string>
     <string name="enable_freeform_support" msgid="1461893351278940416">"फ्रिफर्म विन्डोहरू सक्रिय गर्नुहोस्"</string>
     <string name="enable_freeform_support_summary" msgid="8247310463288834487">"प्रयोगात्मक फ्रिफर्म विन्डोहरूका लागि समर्थन सक्रिय गर्नुहोस्।"</string>
index 7b69c78..54adf82 100644 (file)
@@ -22,7 +22,7 @@
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
   <string-array name="wifi_status">
     <item msgid="1922181315419294640"></item>
-    <item msgid="8934131797783724664">"ஸà¯\8dà®\95à¯\87னà¯\8d à®\9aà¯\86யà¯\8dà®\95ிறதà¯\81â\80¦"</item>
+    <item msgid="8934131797783724664">"தà¯\87à®\9fà¯\81à®\95ிறதà¯\81..."</item>
     <item msgid="8513729475867537913">"இணைக்கிறது..."</item>
     <item msgid="515055375277271756">"அங்கீகரிக்கிறது..."</item>
     <item msgid="1943354004029184381">"IP முகவரியைப் பெறுகிறது…"</item>
@@ -36,7 +36,7 @@
   </string-array>
   <string-array name="wifi_status_with_ssid">
     <item msgid="7714855332363650812"></item>
-    <item msgid="8878186979715711006">"ஸà¯\8dà®\95à¯\87னà¯\8d à®\9aà¯\86யà¯\8dà®\95ிறதà¯\81â\80¦"</item>
+    <item msgid="8878186979715711006">"தà¯\87à®\9fà¯\81à®\95ிறதà¯\81..."</item>
     <item msgid="355508996603873860">"<xliff:g id="NETWORK_NAME">%1$s</xliff:g> இல் இணைக்கிறது…"</item>
     <item msgid="554971459996405634">"<xliff:g id="NETWORK_NAME">%1$s</xliff:g> உடன் அங்கீகரிக்கிறது…"</item>
     <item msgid="7928343808033020343">"<xliff:g id="NETWORK_NAME">%1$s</xliff:g> இலிருந்து IP முகவரியைப் பெறுகிறது…"</item>
   </string-array>
   <string-array name="window_animation_scale_entries">
     <item msgid="8134156599370824081">"அனிமேஷனை முடக்கு"</item>
-    <item msgid="6624864048416710414">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 .5x"</item>
-    <item msgid="2219332261255416635">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 1x"</item>
-    <item msgid="3544428804137048509">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 1.5x"</item>
-    <item msgid="3110710404225974514">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 2x"</item>
-    <item msgid="4402738611528318731">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 5x"</item>
-    <item msgid="6189539267968330656">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 10x"</item>
+    <item msgid="6624864048416710414">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d .5x"</item>
+    <item msgid="2219332261255416635">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 1x"</item>
+    <item msgid="3544428804137048509">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 1.5x"</item>
+    <item msgid="3110710404225974514">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 2x"</item>
+    <item msgid="4402738611528318731">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 5x"</item>
+    <item msgid="6189539267968330656">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 10x"</item>
   </string-array>
   <string-array name="transition_animation_scale_entries">
     <item msgid="8464255836173039442">"அனிமேஷனை முடக்கு"</item>
-    <item msgid="3375781541913316411">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 .5x"</item>
-    <item msgid="1991041427801869945">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 1x"</item>
-    <item msgid="4012689927622382874">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 1.5x"</item>
-    <item msgid="3289156759925947169">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 2x"</item>
-    <item msgid="7705857441213621835">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 5x"</item>
-    <item msgid="6660750935954853365">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 10x"</item>
+    <item msgid="3375781541913316411">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d .5x"</item>
+    <item msgid="1991041427801869945">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 1x"</item>
+    <item msgid="4012689927622382874">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 1.5x"</item>
+    <item msgid="3289156759925947169">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 2x"</item>
+    <item msgid="7705857441213621835">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 5x"</item>
+    <item msgid="6660750935954853365">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 10x"</item>
   </string-array>
   <string-array name="animator_duration_scale_entries">
     <item msgid="6039901060648228241">"அனிமேஷனை முடக்கு"</item>
-    <item msgid="1138649021950863198">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 .5x"</item>
-    <item msgid="4394388961370833040">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 1x"</item>
-    <item msgid="8125427921655194973">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 1.5x"</item>
-    <item msgid="3334024790739189573">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 2x"</item>
-    <item msgid="3170120558236848008">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 5x"</item>
-    <item msgid="1069584980746680398">"à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81 10x"</item>
+    <item msgid="1138649021950863198">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d .5x"</item>
+    <item msgid="4394388961370833040">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 1x"</item>
+    <item msgid="8125427921655194973">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 1.5x"</item>
+    <item msgid="3334024790739189573">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 2x"</item>
+    <item msgid="3170120558236848008">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 5x"</item>
+    <item msgid="1069584980746680398">"à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d 10x"</item>
   </string-array>
   <string-array name="overlay_display_devices_entries">
     <item msgid="1606809880904982133">"ஏதுமில்லை"</item>
index 828e542..5f63fee 100644 (file)
     <string name="track_frame_time" msgid="6094365083096851167">"சுயவிவர HWUI ரெண்டரிங்"</string>
     <string name="enable_gpu_debug_layers" msgid="3848838293793255097">"GPU பிழைத்திருத்த லேயர்களை இயக்கு"</string>
     <string name="enable_gpu_debug_layers_summary" msgid="8009136940671194940">"பிழைத்திருத்த ஆப்ஸிற்கு, GPU பிழைத்திருத்த லேயர்களை ஏற்றுவதற்கு அனுமதி"</string>
-    <string name="window_animation_scale_title" msgid="6162587588166114700">"à®\9aாளர à®\85னிமà¯\87ஷனà¯\8d à®\85ளவà¯\81"</string>
-    <string name="transition_animation_scale_title" msgid="387527540523595875">"à®\85னிமà¯\87ஷனà¯\8d à®®à®¾à®±à¯\8dறதà¯\8dதினà¯\8d à®\85ளவà¯\81"</string>
+    <string name="window_animation_scale_title" msgid="6162587588166114700">"à®\9aாளர à®\85னிமà¯\87ஷனà¯\8d à®µà¯\87à®\95à®®à¯\8d"</string>
+    <string name="transition_animation_scale_title" msgid="387527540523595875">"à®\85னிமà¯\87ஷனà¯\8d à®®à®¾à®±à¯\8dறதà¯\8dதினà¯\8d à®µà¯\87à®\95à®®à¯\8d"</string>
     <string name="animator_duration_scale_title" msgid="3406722410819934083">"அனிமேட்டர் கால அளவு"</string>
     <string name="overlay_display_devices_title" msgid="5364176287998398539">"இரண்டாம்நிலைக் காட்சிகளை உருவகப்படுத்து"</string>
     <string name="debug_applications_category" msgid="4206913653849771549">"ஆப்ஸ்"</string>
     <string name="picture_color_mode" msgid="4560755008730283695">"படத்தின் வண்ணப் பயன்முறை"</string>
     <string name="picture_color_mode_desc" msgid="1141891467675548590">"sRGBஐப் பயன்படுத்தும்"</string>
     <string name="daltonizer_mode_disabled" msgid="7482661936053801862">"முடக்கப்பட்டது"</string>
-    <string name="daltonizer_mode_monochromacy" msgid="8485709880666106721">"à®®à¯\8bனà¯\8bà®\95à¯\81à®°à¯\8bà®®à®\9aி"</string>
+    <string name="daltonizer_mode_monochromacy" msgid="8485709880666106721">"à®\92à®±à¯\8dà®±à¯\88 à®¨à®¿à®±à®¤à¯\8d à®¤à®©à¯\8dà®®à¯\88"</string>
     <string name="daltonizer_mode_deuteranomaly" msgid="5475532989673586329">"நிறம் அடையாளங்காண முடியாமை (சிவப்பு-பச்சை)"</string>
     <string name="daltonizer_mode_protanomaly" msgid="8424148009038666065">"நிறம் அடையாளங்காண முடியாமை (சிவப்பு-பச்சை)"</string>
     <string name="daltonizer_mode_tritanomaly" msgid="481725854987912389">"நிறம் அடையாளங்காண முடியாமை (நீலம்-மஞ்சள்)"</string>
index f9aa062..2bd0b27 100644 (file)
@@ -24,20 +24,22 @@ import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
 
 import android.annotation.Nullable;
 import android.app.Activity;
-import androidx.lifecycle.LifecycleOwner;
 import android.os.Bundle;
 import android.os.PersistableBundle;
 import android.view.Menu;
 import android.view.MenuItem;
 
+import androidx.fragment.app.FragmentActivity;
+import androidx.lifecycle.LifecycleOwner;
+
 /**
  * {@link Activity} that has hooks to observe activity lifecycle events.
  */
-public class ObservableActivity extends Activity implements LifecycleOwner {
+public class ObservableActivity extends FragmentActivity implements LifecycleOwner {
 
     private final Lifecycle mLifecycle = new Lifecycle(this);
 
-    public Lifecycle getLifecycle() {
+    public Lifecycle getSettingsLifecycle() {
         return mLifecycle;
     }
 
index 972e062..869f54f 100644 (file)
@@ -22,14 +22,15 @@ import static androidx.lifecycle.Lifecycle.Event.ON_RESUME;
 import static androidx.lifecycle.Lifecycle.Event.ON_START;
 import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
 
-import android.app.DialogFragment;
-import androidx.lifecycle.LifecycleOwner;
 import android.content.Context;
 import android.os.Bundle;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 
+import androidx.fragment.app.DialogFragment;
+import androidx.lifecycle.LifecycleOwner;
+
 /**
  * {@link DialogFragment} that has hooks to observe fragment lifecycle events.
  */
@@ -37,6 +38,10 @@ public class ObservableDialogFragment extends DialogFragment implements Lifecycl
 
     protected final Lifecycle mLifecycle = new Lifecycle(this);
 
+    public Lifecycle getSettingsLifecycle() {
+        return mLifecycle;
+    }
+
     @Override
     public void onAttach(Context context) {
         super.onAttach(context);
@@ -100,9 +105,4 @@ public class ObservableDialogFragment extends DialogFragment implements Lifecycl
         }
         return lifecycleHandled;
     }
-
-    @Override
-    public Lifecycle getLifecycle() {
-        return mLifecycle;
-    }
 }
index 55597cc..6ba930d 100644 (file)
@@ -24,19 +24,20 @@ import static androidx.lifecycle.Lifecycle.Event.ON_START;
 import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
 
 import android.annotation.CallSuper;
-import android.app.Fragment;
-import androidx.lifecycle.LifecycleOwner;
 import android.content.Context;
 import android.os.Bundle;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 
+import androidx.fragment.app.Fragment;
+import androidx.lifecycle.LifecycleOwner;
+
 public class ObservableFragment extends Fragment implements LifecycleOwner {
 
     private final Lifecycle mLifecycle = new Lifecycle(this);
 
-    public Lifecycle getLifecycle() {
+    public Lifecycle getSettingsLifecycle() {
         return mLifecycle;
     }
 
index 904681c..bd1e5a5 100644 (file)
@@ -24,24 +24,25 @@ import static androidx.lifecycle.Lifecycle.Event.ON_START;
 import static androidx.lifecycle.Lifecycle.Event.ON_STOP;
 
 import android.annotation.CallSuper;
-import androidx.lifecycle.LifecycleOwner;
 import android.content.Context;
 import android.os.Bundle;
-import androidx.preference.PreferenceFragment;
-import androidx.preference.PreferenceScreen;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 
+import androidx.lifecycle.LifecycleOwner;
+import androidx.preference.PreferenceFragmentCompat;
+import androidx.preference.PreferenceScreen;
+
 /**
- * {@link PreferenceFragment} that has hooks to observe fragment lifecycle events.
+ * {@link PreferenceFragmentCompat} that has hooks to observe fragment lifecycle events.
  */
-public abstract class ObservablePreferenceFragment extends PreferenceFragment
+public abstract class ObservablePreferenceFragment extends PreferenceFragmentCompat
         implements LifecycleOwner {
 
     private final Lifecycle mLifecycle = new Lifecycle(this);
 
-    public Lifecycle getLifecycle() {
+    public Lifecycle getSettingsLifecycle() {
         return mLifecycle;
     }
 
index 52068e9..28828a0 100644 (file)
@@ -18,11 +18,12 @@ package com.android.settingslib.core.lifecycle;
 import static androidx.lifecycle.Lifecycle.Event.ON_START;
 import static com.google.common.truth.Truth.assertThat;
 
-import androidx.lifecycle.LifecycleOwner;
 import android.content.Context;
+import android.os.Bundle;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
+import android.widget.LinearLayout;
 
 import com.android.settingslib.SettingsLibRobolectricTestRunner;
 import com.android.settingslib.core.lifecycle.events.OnAttach;
@@ -34,13 +35,15 @@ import com.android.settingslib.core.lifecycle.events.OnPrepareOptionsMenu;
 import com.android.settingslib.core.lifecycle.events.OnResume;
 import com.android.settingslib.core.lifecycle.events.OnStart;
 import com.android.settingslib.core.lifecycle.events.OnStop;
+import com.android.settingslib.testutils.FragmentTestUtils;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.robolectric.Robolectric;
 import org.robolectric.android.controller.ActivityController;
-import org.robolectric.android.controller.FragmentController;
+
+import androidx.lifecycle.LifecycleOwner;
 
 @RunWith(SettingsLibRobolectricTestRunner.class)
 public class LifecycleTest {
@@ -64,7 +67,7 @@ public class LifecycleTest {
 
         public TestFragment() {
             mFragObserver = new TestObserver();
-            getLifecycle().addObserver(mFragObserver);
+            getSettingsLifecycle().addObserver(mFragObserver);
         }
     }
 
@@ -74,9 +77,17 @@ public class LifecycleTest {
 
         public TestActivity() {
             mActObserver = new TestObserver();
-            getLifecycle().addObserver(mActObserver);
+            getSettingsLifecycle().addObserver(mActObserver);
         }
 
+        @Override
+        protected void onCreate(Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+            LinearLayout view = new LinearLayout(this);
+            view.setId(1);
+
+            setContentView(view);
+        }
     }
 
     public static class TestObserver implements LifecycleObserver, OnAttach, OnStart, OnResume,
@@ -151,11 +162,9 @@ public class LifecycleTest {
     @Test
     public void runThroughActivityLifecycles_shouldObserveEverything() {
         ActivityController<TestActivity> ac = Robolectric.buildActivity(TestActivity.class);
-        TestActivity activity = ac.get();
+        TestActivity activity = ac.setup().get();
 
-        ac.start();
         assertThat(activity.mActObserver.mOnStartObserved).isTrue();
-        ac.resume();
         assertThat(activity.mActObserver.mOnResumeObserved).isTrue();
         activity.onCreateOptionsMenu(null);
         assertThat(activity.mActObserver.mOnCreateOptionsMenuObserved).isTrue();
@@ -173,50 +182,50 @@ public class LifecycleTest {
 
     @Test
     public void runThroughDialogFragmentLifecycles_shouldObserveEverything() {
-        FragmentController<TestDialogFragment> fragmentController =
-                Robolectric.buildFragment(TestDialogFragment.class);
-        TestDialogFragment fragment = fragmentController.get();
+        final TestDialogFragment fragment = new TestDialogFragment();
+        FragmentTestUtils.startFragment(fragment);
 
-        fragmentController.create().start().resume();
         fragment.onCreateOptionsMenu(null, null);
         fragment.onPrepareOptionsMenu(null);
         fragment.onOptionsItemSelected(null);
-        fragmentController.pause().stop().destroy();
+        assertThat(fragment.mFragObserver.mOnCreateOptionsMenuObserved).isTrue();
+        assertThat(fragment.mFragObserver.mOnPrepareOptionsMenuObserved).isTrue();
+        assertThat(fragment.mFragObserver.mOnOptionsItemSelectedObserved).isTrue();
 
         assertThat(fragment.mFragObserver.mOnAttachObserved).isTrue();
         assertThat(fragment.mFragObserver.mOnAttachHasContext).isTrue();
         assertThat(fragment.mFragObserver.mOnStartObserved).isTrue();
         assertThat(fragment.mFragObserver.mOnResumeObserved).isTrue();
+        fragment.onPause();
         assertThat(fragment.mFragObserver.mOnPauseObserved).isTrue();
+        fragment.onStop();
         assertThat(fragment.mFragObserver.mOnStopObserved).isTrue();
+        fragment.onDestroy();
         assertThat(fragment.mFragObserver.mOnDestroyObserved).isTrue();
-        assertThat(fragment.mFragObserver.mOnCreateOptionsMenuObserved).isTrue();
-        assertThat(fragment.mFragObserver.mOnPrepareOptionsMenuObserved).isTrue();
-        assertThat(fragment.mFragObserver.mOnOptionsItemSelectedObserved).isTrue();
     }
 
     @Test
     public void runThroughFragmentLifecycles_shouldObserveEverything() {
-        FragmentController<TestFragment> fragmentController =
-                Robolectric.buildFragment(TestFragment.class);
-        TestFragment fragment = fragmentController.get();
+        final TestFragment fragment = new TestFragment();
+        FragmentTestUtils.startFragment(fragment);
 
-        fragmentController.create().start().resume();
         fragment.onCreateOptionsMenu(null, null);
         fragment.onPrepareOptionsMenu(null);
         fragment.onOptionsItemSelected(null);
-        fragmentController.pause().stop().destroy();
+        assertThat(fragment.mFragObserver.mOnCreateOptionsMenuObserved).isTrue();
+        assertThat(fragment.mFragObserver.mOnPrepareOptionsMenuObserved).isTrue();
+        assertThat(fragment.mFragObserver.mOnOptionsItemSelectedObserved).isTrue();
 
         assertThat(fragment.mFragObserver.mOnAttachObserved).isTrue();
         assertThat(fragment.mFragObserver.mOnAttachHasContext).isTrue();
         assertThat(fragment.mFragObserver.mOnStartObserved).isTrue();
         assertThat(fragment.mFragObserver.mOnResumeObserved).isTrue();
+        fragment.onPause();
         assertThat(fragment.mFragObserver.mOnPauseObserved).isTrue();
+        fragment.onStop();
         assertThat(fragment.mFragObserver.mOnStopObserved).isTrue();
+        fragment.onDestroy();
         assertThat(fragment.mFragObserver.mOnDestroyObserved).isTrue();
-        assertThat(fragment.mFragObserver.mOnCreateOptionsMenuObserved).isTrue();
-        assertThat(fragment.mFragObserver.mOnPrepareOptionsMenuObserved).isTrue();
-        assertThat(fragment.mFragObserver.mOnOptionsItemSelectedObserved).isTrue();
     }
 
     @Test
@@ -237,17 +246,16 @@ public class LifecycleTest {
 
     @Test
     public void onOptionItemSelectedShortCircuitsIfAnObserverHandlesTheMenuItem() {
-        FragmentController<TestFragment> fragmentController =
-                Robolectric.buildFragment(TestFragment.class);
-        TestFragment fragment = fragmentController.get();
-        OptionItemAccepter accepter = new OptionItemAccepter();
+        final TestFragment fragment = new TestFragment();
+        FragmentTestUtils.startFragment(fragment);
+
+        final OptionItemAccepter accepter = new OptionItemAccepter();
         fragment.getLifecycle().addObserver(accepter);
 
-        fragmentController.create().start().resume();
+
         fragment.onCreateOptionsMenu(null, null);
         fragment.onPrepareOptionsMenu(null);
         fragment.onOptionsItemSelected(null);
-        fragmentController.pause().stop().destroy();
 
         assertThat(accepter.wasCalled).isFalse();
     }
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/testutils/FragmentTestUtils.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/testutils/FragmentTestUtils.java
new file mode 100644 (file)
index 0000000..8ba8606
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settingslib.testutils;
+
+import android.os.Bundle;
+import android.widget.LinearLayout;
+
+import org.robolectric.Robolectric;
+
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentActivity;
+import androidx.fragment.app.FragmentManager;
+
+/**
+ * Utilities for creating Fragments for testing.
+ * <p>
+ * TODO(b/111195449) - Duplicated from org.robolectric.shadows.support.v4.SupportFragmentTestUtil
+ */
+@Deprecated
+public class FragmentTestUtils {
+
+    public static void startFragment(Fragment fragment) {
+        buildFragmentManager(FragmentUtilActivity.class)
+                .beginTransaction().add(fragment, null).commit();
+    }
+
+    public static void startFragment(Fragment fragment,
+            Class<? extends FragmentActivity> activityClass) {
+        buildFragmentManager(activityClass)
+                .beginTransaction().add(fragment, null).commit();
+    }
+
+    public static void startVisibleFragment(Fragment fragment) {
+        buildFragmentManager(FragmentUtilActivity.class)
+                .beginTransaction().add(1, fragment, null).commit();
+    }
+
+    public static void startVisibleFragment(Fragment fragment,
+            Class<? extends FragmentActivity> activityClass, int containerViewId) {
+        buildFragmentManager(activityClass)
+                .beginTransaction().add(containerViewId, fragment, null).commit();
+    }
+
+    private static FragmentManager buildFragmentManager(
+            Class<? extends FragmentActivity> activityClass) {
+        FragmentActivity activity = Robolectric.setupActivity(activityClass);
+        return activity.getSupportFragmentManager();
+    }
+
+    private static class FragmentUtilActivity extends FragmentActivity {
+        @Override
+        protected void onCreate(Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+            LinearLayout view = new LinearLayout(this);
+            view.setId(1);
+
+            setContentView(view);
+        }
+    }
+}
index 375fef8..9592b63 100644 (file)
@@ -2935,7 +2935,7 @@ public class SettingsProvider extends ContentProvider {
         }
 
         private final class UpgradeController {
-            private static final int SETTINGS_VERSION = 169;
+            private static final int SETTINGS_VERSION = 170;
 
             private final int mUserId;
 
@@ -3810,6 +3810,37 @@ public class SettingsProvider extends ContentProvider {
                     currentVersion = 169;
                 }
 
+                if (currentVersion == 169) {
+                    // Version 169: by default, add STREAM_VOICE_CALL to list of streams that can
+                    // be muted.
+                    final SettingsState systemSettings = getSystemSettingsLocked(userId);
+                    final Setting currentSetting = systemSettings.getSettingLocked(
+                              Settings.System.MUTE_STREAMS_AFFECTED);
+                    if (!currentSetting.isNull()) {
+                        try {
+                            int currentSettingIntegerValue = Integer.parseInt(
+                                    currentSetting.getValue());
+                            if ((currentSettingIntegerValue
+                                 & (1 << AudioManager.STREAM_VOICE_CALL)) == 0) {
+                                systemSettings.insertSettingLocked(
+                                    Settings.System.MUTE_STREAMS_AFFECTED,
+                                    Integer.toString(
+                                        currentSettingIntegerValue
+                                        | (1 << AudioManager.STREAM_VOICE_CALL)),
+                                    null, true, SettingsState.SYSTEM_PACKAGE_NAME);
+                            }
+                        } catch (NumberFormatException e) {
+                            // remove the setting in case it is not a valid integer
+                            Slog.w("Failed to parse integer value of MUTE_STREAMS_AFFECTED"
+                                   + "setting, removing setting", e);
+                            systemSettings.deleteSettingLocked(
+                                Settings.System.MUTE_STREAMS_AFFECTED);
+                        }
+
+                    }
+                    currentVersion = 170;
+                }
+
                 // vXXX: Add new settings above this point.
 
                 if (currentVersion != newVersion) {
index f62249a..a9d995c 100644 (file)
          -->
     <dimen name="qs_header_system_icons_area_height">48dp</dimen>
 
+    <!-- How far the quick-quick settings panel extends below the status bar -->
+    <dimen name="qs_quick_header_panel_height">128dp</dimen>
+
     <!-- The height of the container that holds the system icons in the quick settings header in the
          car setting. -->
     <dimen name="car_qs_header_system_icons_area_height">54dp</dimen>
index a218868..35d2f90 100644 (file)
@@ -33,6 +33,7 @@ import android.media.AudioManager;
 import android.os.Handler;
 import android.provider.AlarmClock;
 import android.service.notification.ZenModeConfig;
+import android.widget.FrameLayout;
 import androidx.annotation.VisibleForTesting;
 import android.text.format.DateUtils;
 import android.util.AttributeSet;
@@ -270,8 +271,22 @@ public class QuickStatusBarHeader extends RelativeLayout implements
         updateResources();
     }
 
+    /**
+     * The height of QQS should always be the status bar height + 128dp. This is normally easy, but
+     * when there is a notch involved the status bar can remain a fixed pixel size.
+     */
+    private void updateMinimumHeight() {
+        int sbHeight = mContext.getResources().getDimensionPixelSize(
+                com.android.internal.R.dimen.status_bar_height);
+        int qqsHeight = mContext.getResources().getDimensionPixelSize(
+                R.dimen.qs_quick_header_panel_height);
+
+        setMinimumHeight(sbHeight + qqsHeight);
+    }
+
     private void updateResources() {
         Resources resources = mContext.getResources();
+        updateMinimumHeight();
 
         // Update height for a few views, especially due to landscape mode restricting space.
         mHeaderTextContainerView.getLayoutParams().height =
@@ -282,10 +297,17 @@ public class QuickStatusBarHeader extends RelativeLayout implements
                 com.android.internal.R.dimen.quick_qs_offset_height);
         mSystemIconsView.setLayoutParams(mSystemIconsView.getLayoutParams());
 
-        getLayoutParams().height = resources.getDimensionPixelSize(mQsDisabled
-                ? com.android.internal.R.dimen.quick_qs_offset_height
-                : com.android.internal.R.dimen.quick_qs_total_height);
-        setLayoutParams(getLayoutParams());
+        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
+        if (mQsDisabled) {
+            lp.height = resources.getDimensionPixelSize(
+                    com.android.internal.R.dimen.quick_qs_offset_height);
+        } else {
+            lp.height = Math.max(getMinimumHeight(),
+                    resources.getDimensionPixelSize(
+                            com.android.internal.R.dimen.quick_qs_offset_height));
+        }
+
+        setLayoutParams(lp);
 
         updateStatusIconAlphaAnimator();
         updateHeaderTextContainerAlphaAnimator();
index ea70ebb..a781be6 100644 (file)
@@ -189,6 +189,14 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
             state |= DISABLE_SYSTEM_INFO;
             state |= DISABLE_CLOCK;
         }
+
+        // In landscape, the heads up show but shouldHideNotificationIcons() return false
+        // because the visual icon is in notification icon area rather than heads up's space.
+        // whether the notification icon show or not, clock should hide when heads up show.
+        if (mStatusBarComponent.isHeadsUpShouldBeVisible()) {
+            state |= DISABLE_CLOCK;
+        }
+
         if (mNetworkController != null && EncryptionHelper.IS_DATA_ENCRYPTED) {
             if (mNetworkController.hasEmergencyCryptKeeperText()) {
                 state |= DISABLE_NOTIFICATION_ICONS;
index 5a07dbd..240d467 100644 (file)
@@ -2533,7 +2533,8 @@ public class NotificationPanelView extends PanelView implements
     }
 
     private void updateStatusBarIcons() {
-        boolean showIconsWhenExpanded = isFullWidth() && getExpandedHeight() < getOpeningHeight();
+        boolean showIconsWhenExpanded = (isPanelVisibleBecauseOfHeadsUp() || isFullWidth())
+                && getExpandedHeight() < getOpeningHeight();
         if (showIconsWhenExpanded && mNoVisibleNotifications && isOnKeyguard()) {
             showIconsWhenExpanded = false;
         }
index 66064b6..5b42d5e 100644 (file)
@@ -895,6 +895,16 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo
         for (ScrimState state : ScrimState.values()) {
             state.setHasBackdrop(hasBackdrop);
         }
+
+        // Backdrop event may arrive after state was already applied,
+        // in this case, back-scrim needs to be re-evaluated
+        if (mState == ScrimState.AOD || mState == ScrimState.PULSING) {
+            float newBehindAlpha = mState.getBehindAlpha(mNotificationDensity);
+            if (mCurrentBehindAlpha != newBehindAlpha) {
+                mCurrentBehindAlpha = newBehindAlpha;
+                updateScrims();
+            }
+        }
     }
 
     public void setLaunchingAffordanceWithPreview(boolean launchingAffordanceWithPreview) {
index 19015fc..081ebfa 100644 (file)
@@ -105,7 +105,6 @@ public enum ScrimState {
         public void prepare(ScrimState previousState) {
             final boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn();
             mBlankScreen = mDisplayRequiresBlanking;
-            mCurrentBehindAlpha = mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f;
             mCurrentInFrontAlpha = alwaysOnEnabled ? mAodFrontScrimAlpha : 1f;
             mCurrentInFrontTint = Color.BLACK;
             mCurrentBehindTint = Color.BLACK;
@@ -116,6 +115,11 @@ public enum ScrimState {
         }
 
         @Override
+        public float getBehindAlpha(float busyness) {
+            return mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f;
+        }
+
+        @Override
         public boolean isLowPowerState() {
             return true;
         }
@@ -129,10 +133,14 @@ public enum ScrimState {
         public void prepare(ScrimState previousState) {
             mCurrentInFrontAlpha = 0;
             mCurrentInFrontTint = Color.BLACK;
-            mCurrentBehindAlpha = mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f;
             mCurrentBehindTint = Color.BLACK;
             mBlankScreen = mDisplayRequiresBlanking;
         }
+
+        @Override
+        public float getBehindAlpha(float busyness) {
+            return mWallpaperSupportsAmbientMode && !mHasBackdrop ? 0f : 1f;
+        }
     },
 
     /**
index 7cf2c33..4b5a7b1 100644 (file)
@@ -2155,6 +2155,10 @@ public class StatusBar extends SystemUI implements DemoMode,
         }
     }
 
+    public boolean isHeadsUpShouldBeVisible() {
+        return mHeadsUpAppearanceController.shouldBeVisible();
+    }
+
     /**
      * All changes to the status bar and notifications funnel through here and are batched.
      */
index 6fc4911..5dc7199 100644 (file)
@@ -1425,7 +1425,8 @@ public class NotificationStackScrollLayout extends ViewGroup
      */
     private int targetScrollForView(ExpandableView v, int positionInLinearLayout) {
         return positionInLinearLayout + v.getIntrinsicHeight() +
-                getImeInset() - getHeight() + getTopPadding();
+                getImeInset() - getHeight()
+                + ((!isExpanded() && isPinnedHeadsUp(v)) ? mHeadsUpInset : getTopPadding());
     }
 
     @Override
@@ -2056,9 +2057,15 @@ public class NotificationStackScrollLayout extends ViewGroup
     }
 
     private int getScrollRange() {
-        int scrollRange = Math.max(0, mContentHeight - mMaxLayoutHeight);
+        // In current design, it only use the top HUN to treat all of HUNs
+        // although there are more than one HUNs
+        int contentHeight = mContentHeight;
+        if (!isExpanded() && mHeadsUpManager.hasPinnedHeadsUp()) {
+            contentHeight = mHeadsUpInset + getTopHeadsUpPinnedHeight();
+        }
+        int scrollRange = Math.max(0, contentHeight - mMaxLayoutHeight);
         int imeInset = getImeInset();
-        scrollRange += Math.min(imeInset, Math.max(0, mContentHeight - (getHeight() - imeInset)));
+        scrollRange += Math.min(imeInset, Math.max(0, contentHeight - (getHeight() - imeInset)));
         return scrollRange;
     }
 
index ee006d3..886bd5e 100644 (file)
@@ -473,6 +473,15 @@ public class StackScrollAlgorithm {
                     childState.yTranslation = topState.yTranslation + topState.height
                             - childState.height;
                 }
+
+                // heads up notification show and this row is the top entry of heads up
+                // notifications. i.e. this row should be the only one row that has input field
+                // To check if the row need to do translation according to scroll Y
+                // heads up show full of row's content and any scroll y indicate that the
+                // translationY need to move up the HUN.
+                if (!mIsExpanded && isTopEntry && ambientState.getScrollY() > 0) {
+                    childState.yTranslation -= ambientState.getScrollY();
+                }
             }
             if (row.isHeadsUpAnimatingAway()) {
                 childState.hidden = false;
index 89d562a..9c55874 100644 (file)
@@ -152,6 +152,20 @@ public class ScrimControllerTest extends SysuiTestCase {
     }
 
     @Test
+    public void setHasBackdrop_withAodWallpaperAndAlbumArt() {
+        mScrimController.setWallpaperSupportsAmbientMode(true);
+        mScrimController.transitionTo(ScrimState.AOD);
+        mScrimController.finishAnimationsImmediately();
+        mScrimController.setHasBackdrop(true);
+        mScrimController.finishAnimationsImmediately();
+        // Front scrim should be transparent
+        // Back scrim should be visible with tint
+        assertScrimVisibility(VISIBILITY_FULLY_TRANSPARENT, VISIBILITY_FULLY_OPAQUE);
+        assertScrimTint(mScrimBehind, true /* tinted */);
+        assertScrimTint(mScrimInFront, true /* tinted */);
+    }
+
+    @Test
     public void transitionToAod_withFrontAlphaUpdates() {
         // Assert that setting the AOD front scrim alpha doesn't take effect in a non-AOD state.
         mScrimController.transitionTo(ScrimState.KEYGUARD);
diff --git a/sax/tests/saxtests/src/android/sax/ExpatPerformanceTest.java b/sax/tests/saxtests/src/android/sax/ExpatPerformanceTest.java
deleted file mode 100644 (file)
index 892c490..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.sax;
-
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.LargeTest;
-import android.util.Log;
-import android.util.Xml;
-import org.kxml2.io.KXmlParser;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import com.android.frameworks.saxtests.R;
-
-public class ExpatPerformanceTest extends AndroidTestCase {
-
-    private static final String TAG = ExpatPerformanceTest.class.getSimpleName();
-
-    private byte[] mXmlBytes;
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        InputStream in = mContext.getResources().openRawResource(R.raw.youtube);
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        byte[] buffer = new byte[1024];
-        int length;
-        while ((length = in.read(buffer)) != -1) {
-            out.write(buffer, 0, length);
-        }
-        mXmlBytes = out.toByteArray();
-
-        Log.i("***", "File size: " + (mXmlBytes.length / 1024) + "k");
-    }
-
-    @LargeTest
-    public void testPerformance() throws Exception {
-//        try {
-//            Debug.startMethodTracing("expat3");
-//        for (int i = 0; i < 1; i++) {
-            runJavaPullParser();
-            runSax();
-            runExpatPullParser();
-//        }
-//    } finally {
-//            Debug.stopMethodTracing();
-//        }
-    }
-
-    private InputStream newInputStream() {
-        return new ByteArrayInputStream(mXmlBytes);
-    }
-
-    private void runSax() throws IOException, SAXException {
-        long start = System.currentTimeMillis();
-        Xml.parse(newInputStream(), Xml.Encoding.UTF_8, new DefaultHandler());
-        long elapsed = System.currentTimeMillis() - start;
-        Log.i(TAG, "expat SAX: " + elapsed + "ms");
-    }
-
-    private void runExpatPullParser() throws XmlPullParserException, IOException {
-        long start = System.currentTimeMillis();
-        XmlPullParser pullParser = Xml.newPullParser();
-        pullParser.setInput(newInputStream(), "UTF-8");
-        withPullParser(pullParser);
-        long elapsed = System.currentTimeMillis() - start;
-        Log.i(TAG, "expat pull: " + elapsed + "ms");
-    }
-
-    private void runJavaPullParser() throws XmlPullParserException, IOException {
-        XmlPullParser pullParser;
-        long start = System.currentTimeMillis();
-        pullParser = new KXmlParser();
-        pullParser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
-        pullParser.setInput(newInputStream(), "UTF-8");
-        withPullParser(pullParser);
-        long elapsed = System.currentTimeMillis() - start;
-        Log.i(TAG, "java pull parser: " + elapsed + "ms");
-    }
-
-    private static void withPullParser(XmlPullParser pullParser)
-            throws IOException, XmlPullParserException {
-        int eventType = pullParser.next();
-        while (eventType != XmlPullParser.END_DOCUMENT) {
-            switch (eventType) {
-                case XmlPullParser.START_TAG:
-                    pullParser.getName();
-//                        int nattrs = pullParser.getAttributeCount();
-//                        for (int i = 0; i < nattrs; ++i) {
-//                            pullParser.getAttributeName(i);
-//                            pullParser.getAttributeValue(i);
-//                        }
-                    break;
-                case XmlPullParser.END_TAG:
-                    pullParser.getName();
-                    break;
-                case XmlPullParser.TEXT:
-                    pullParser.getText();
-                    break;
-            }
-            eventType = pullParser.next();
-        }
-    }
-}
index c22dedc..a1f1ff9 100644 (file)
@@ -97,7 +97,7 @@ class AppTaskImpl extends IAppTask.Stub {
         final int callingUid = Binder.getCallingUid();
         final long origId = Binder.clearCallingIdentity();
         try {
-            synchronized (this) {
+            synchronized (mService.mGlobalLock) {
                 mService.mStackSupervisor.startActivityFromRecents(callingPid, callingUid, mTaskId,
                         null);
             }
index a2a55e5..0eb18a8 100644 (file)
@@ -200,6 +200,8 @@ final class Constants {
 
     static final int UNKNOWN_VOLUME = -1;
 
+    static final String PROPERTY_PREFERRED_ADDRESS_AUDIO_SYSTEM =
+            "persist.sys.hdmi.addr.audiosystem";
     static final String PROPERTY_PREFERRED_ADDRESS_PLAYBACK = "persist.sys.hdmi.addr.playback";
     static final String PROPERTY_PREFERRED_ADDRESS_TV = "persist.sys.hdmi.addr.tv";
 
index c7cdbef..1dd10f5 100755 (executable)
@@ -169,6 +169,8 @@ abstract class HdmiCecLocalDevice {
             return new HdmiCecLocalDeviceTv(service);
         case HdmiDeviceInfo.DEVICE_PLAYBACK:
             return new HdmiCecLocalDevicePlayback(service);
+        case HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM:
+            return new HdmiCecLocalDeviceAudioSystem(service);
         default:
             return null;
         }
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceAudioSystem.java
new file mode 100644 (file)
index 0000000..9b545c0
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.server.hdmi;
+
+
+import android.hardware.hdmi.HdmiDeviceInfo;
+import android.os.SystemProperties;
+
+/**
+ * Represent a logical device of type {@link HdmiDeviceInfo#DEVICE_AUDIO_SYSTEM} residing in
+ * Android system.
+ */
+public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDevice {
+
+    protected HdmiCecLocalDeviceAudioSystem(HdmiControlService service) {
+        super(service, HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM);
+    }
+
+    @Override
+    @HdmiAnnotations.ServiceThreadOnly
+    protected void onAddressAllocated(int logicalAddress, int reason) {
+        assertRunOnServiceThread();
+        mService.sendCecCommand(HdmiCecMessageBuilder.buildReportPhysicalAddressCommand(
+                mAddress, mService.getPhysicalAddress(), mDeviceType));
+        mService.sendCecCommand(HdmiCecMessageBuilder.buildDeviceVendorIdCommand(
+                mAddress, mService.getVendorId()));
+        startQueuedActions();
+    }
+
+    @Override
+    @HdmiAnnotations.ServiceThreadOnly
+    protected int getPreferredAddress() {
+        assertRunOnServiceThread();
+        return SystemProperties.getInt(Constants.PROPERTY_PREFERRED_ADDRESS_AUDIO_SYSTEM,
+                Constants.ADDR_UNREGISTERED);
+    }
+
+    @Override
+    @HdmiAnnotations.ServiceThreadOnly
+    protected void setPreferredAddress(int addr) {
+        assertRunOnServiceThread();
+        SystemProperties.set(Constants.PROPERTY_PREFERRED_ADDRESS_AUDIO_SYSTEM,
+                String.valueOf(addr));
+    }
+}
index 79e84ee..37f9614 100644 (file)
@@ -442,10 +442,8 @@ public class HdmiCecMessageBuilder {
      * @return newly created {@link HdmiCecMessage}
      */
     static HdmiCecMessage buildReportAudioStatus(int src, int dest, int volume, boolean mute) {
-        byte[] params = new byte[] {
-            mute ? (byte) (1 & 0xFF) : (byte) (0 & 0xFF),
-            (byte) (volume & 0xFF)
-        };
+        byte status = (byte) ((byte) (mute ? 1 << 7 : 0) | ((byte) volume & 0x7F));
+        byte[] params = new byte[] { status };
         return buildCommand(src, dest, Constants.MESSAGE_REPORT_AUDIO_STATUS, params);
     }
 
index 17160be..b92d52c 100644 (file)
@@ -685,13 +685,14 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
                 // inserted above to hold the session active.
                 try {
                     final Int64Ref last = new Int64Ref(0);
-                    FileUtils.copy(incomingFd.getFileDescriptor(), targetFd, (long progress) -> {
-                        if (params.sizeBytes > 0) {
-                            final long delta = progress - last.value;
-                            last.value = progress;
-                            addClientProgress((float) delta / (float) params.sizeBytes);
-                        }
-                    }, null, lengthBytes);
+                    FileUtils.copy(incomingFd.getFileDescriptor(), targetFd, lengthBytes, null,
+                            Runnable::run, (long progress) -> {
+                                if (params.sizeBytes > 0) {
+                                    final long delta = progress - last.value;
+                                    last.value = progress;
+                                    addClientProgress((float) delta / (float) params.sizeBytes);
+                                }
+                            });
                 } finally {
                     IoUtils.closeQuietly(targetFd);
                     IoUtils.closeQuietly(incomingFd);
index 4fbc14c..e8266a5 100644 (file)
@@ -243,7 +243,7 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks,
             intent.setData(Uri.fromParts("printjob", printJob.getId().flattenToString(), null));
             intent.putExtra(PrintManager.EXTRA_PRINT_DOCUMENT_ADAPTER, adapter.asBinder());
             intent.putExtra(PrintManager.EXTRA_PRINT_JOB, printJob);
-            intent.putExtra(DocumentsContract.EXTRA_PACKAGE_NAME, packageName);
+            intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName);
 
             IntentSender intentSender = PendingIntent.getActivityAsUser(
                     mContext, 0, intent, PendingIntent.FLAG_ONE_SHOT
index bba779d..e881549 100644 (file)
@@ -85,12 +85,12 @@ public class NetworkRegistrationState implements Parcelable {
     public static final int SERVICE_TYPE_VIDEO = 4;
     public static final int SERVICE_TYPE_EMERGENCY = 5;
 
-    /** {@link AccessNetworkConstants.TransportType}*/
-    private final int mTransportType;
-
     @Domain
     private final int mDomain;
 
+    /** {@link AccessNetworkConstants.TransportType}*/
+    private final int mTransportType;
+
     @RegState
     private final int mRegState;
 
@@ -112,19 +112,19 @@ public class NetworkRegistrationState implements Parcelable {
     private DataSpecificRegistrationStates mDataSpecificStates;
 
     /**
-     * @param transportType Transport type. Must be {@link AccessNetworkConstants.TransportType}
      * @param domain Network domain. Must be DOMAIN_CS or DOMAIN_PS.
+     * @param transportType Transport type. Must be {@link AccessNetworkConstants.TransportType}
      * @param regState Network registration state.
      * @param accessNetworkTechnology See TelephonyManager NETWORK_TYPE_XXXX.
      * @param reasonForDenial Reason for denial if the registration state is DENIED.
      * @param availableServices The supported service.
      * @param cellIdentity The identity representing a unique cell
      */
-    public NetworkRegistrationState(int transportType, int domain, int regState,
+    public NetworkRegistrationState(int domain, int transportType, int regState,
             int accessNetworkTechnology, int reasonForDenial, boolean emergencyOnly,
             int[] availableServices, @Nullable CellIdentity cellIdentity) {
-        mTransportType = transportType;
         mDomain = domain;
+        mTransportType = transportType;
         mRegState = regState;
         mAccessNetworkTechnology = accessNetworkTechnology;
         mReasonForDenial = reasonForDenial;
@@ -137,11 +137,11 @@ public class NetworkRegistrationState implements Parcelable {
      * Constructor for voice network registration states.
      * @hide
      */
-    public NetworkRegistrationState(int transportType, int domain, int regState,
+    public NetworkRegistrationState(int domain, int transportType, int regState,
             int accessNetworkTechnology, int reasonForDenial, boolean emergencyOnly,
             int[] availableServices, @Nullable CellIdentity cellIdentity, boolean cssSupported,
             int roamingIndicator, int systemIsInPrl, int defaultRoamingIndicator) {
-        this(transportType, domain, regState, accessNetworkTechnology,
+        this(domain, transportType, regState, accessNetworkTechnology,
                 reasonForDenial, emergencyOnly, availableServices, cellIdentity);
 
         mVoiceSpecificStates = new VoiceSpecificRegistrationStates(cssSupported, roamingIndicator,
@@ -152,18 +152,18 @@ public class NetworkRegistrationState implements Parcelable {
      * Constructor for data network registration states.
      * @hide
      */
-    public NetworkRegistrationState(int transportType, int domain, int regState,
+    public NetworkRegistrationState(int domain, int transportType, int regState,
             int accessNetworkTechnology, int reasonForDenial, boolean emergencyOnly,
             int[] availableServices, @Nullable CellIdentity cellIdentity, int maxDataCalls) {
-        this(transportType, domain, regState, accessNetworkTechnology,
+        this(domain, transportType, regState, accessNetworkTechnology,
                 reasonForDenial, emergencyOnly, availableServices, cellIdentity);
 
         mDataSpecificStates = new DataSpecificRegistrationStates(maxDataCalls);
     }
 
     protected NetworkRegistrationState(Parcel source) {
-        mTransportType = source.readInt();
         mDomain = source.readInt();
+        mTransportType = source.readInt();
         mRegState = source.readInt();
         mAccessNetworkTechnology = source.readInt();
         mReasonForDenial = source.readInt();
@@ -260,8 +260,8 @@ public class NetworkRegistrationState implements Parcelable {
     @Override
     public String toString() {
         return new StringBuilder("NetworkRegistrationState{")
-                .append("transportType=").append(mTransportType)
                 .append(" domain=").append((mDomain == DOMAIN_CS) ? "CS" : "PS")
+                .append("transportType=").append(mTransportType)
                 .append(" regState=").append(regStateToString(mRegState))
                 .append(" accessNetworkTechnology=")
                 .append(TelephonyManager.getNetworkTypeName(mAccessNetworkTechnology))
@@ -290,8 +290,8 @@ public class NetworkRegistrationState implements Parcelable {
         }
 
         NetworkRegistrationState other = (NetworkRegistrationState) o;
-        return mTransportType == other.mTransportType
-                && mDomain == other.mDomain
+        return mDomain == other.mDomain
+                && mTransportType == other.mTransportType
                 && mRegState == other.mRegState
                 && mAccessNetworkTechnology == other.mAccessNetworkTechnology
                 && mReasonForDenial == other.mReasonForDenial
@@ -305,8 +305,8 @@ public class NetworkRegistrationState implements Parcelable {
 
     @Override
     public void writeToParcel(Parcel dest, int flags) {
-        dest.writeInt(mTransportType);
         dest.writeInt(mDomain);
+        dest.writeInt(mTransportType);
         dest.writeInt(mRegState);
         dest.writeInt(mAccessNetworkTechnology);
         dest.writeInt(mReasonForDenial);
index ae999c3..9e8529e 100644 (file)
@@ -1569,13 +1569,14 @@ public class ServiceState implements Parcelable {
     /**
      * Get the network registration states with given transport type and domain.
      *
+     * @param domain The network domain. Must be {@link NetworkRegistrationState#DOMAIN_CS} or
+     * {@link NetworkRegistrationState#DOMAIN_PS}.
      * @param transportType The transport type. See {@link AccessNetworkConstants.TransportType}
-     * @param domain The network domain. Must be DOMAIN_CS or DOMAIN_PS.
      * @return The matching NetworkRegistrationState.
      * @hide
      */
     @SystemApi
-    public NetworkRegistrationState getNetworkRegistrationStates(int transportType, int domain) {
+    public NetworkRegistrationState getNetworkRegistrationStates(int domain, int transportType) {
         synchronized (mNetworkRegistrationStates) {
             for (NetworkRegistrationState networkRegistrationState : mNetworkRegistrationStates) {
                 if (networkRegistrationState.getTransportType() == transportType