OSDN Git Service

Merge tag 'android-7.1.2_r36' into nougat-x86 android-x86-7.1-r1
authorChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 4 Jan 2018 08:31:43 +0000 (16:31 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 4 Jan 2018 08:31:43 +0000 (16:31 +0800)
Android 7.1.2 Release 36 (N2G48H)

29 files changed:
Android.mk
cmds/input/input
cmds/input/src/com/android/commands/input/Input.java
core/java/android/app/Activity.java
core/java/android/hardware/Camera.java
core/java/android/os/storage/DiskInfo.java
core/java/com/android/internal/os/RuntimeInit.java
core/java/com/android/internal/os/ZygoteInit.java
core/jni/android/graphics/YuvToJpegEncoder.cpp
core/jni/fd_utils-inl.h
core/res/res/values-zh-rCN/strings.xml
core/res/res/values-zh-rHK/strings.xml
core/res/res/values-zh-rTW/strings.xml
core/res/res/values/strings.xml
core/res/res/values/symbols.xml
core/tests/coretests/src/android/os/BinderThreadPriorityTest.java
data/keyboards/Generic.kl
media/java/android/media/MediaFile.java
opengl/java/android/opengl/GLSurfaceView.java
packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
packages/SystemUI/src/com/android/systemui/recents/views/RecentsTransitionHelper.java
services/core/java/com/android/server/AlarmManagerService.java
services/core/java/com/android/server/WiredAccessoryManager.java
services/core/java/com/android/server/display/DisplayManagerService.java
services/core/java/com/android/server/input/InputManagerService.java
services/core/java/com/android/server/policy/PhoneWindowManager.java
services/core/java/com/android/server/wm/DisplayContent.java
services/core/java/com/android/server/wm/WindowState.java
services/core/jni/com_android_server_AlarmManagerService.cpp

index 730eeb1..7e17956 100644 (file)
@@ -496,6 +496,8 @@ LOCAL_NO_STANDARD_LIBRARIES := true
 LOCAL_JAVA_LIBRARIES := core-oj core-libart core-lambda-stubs conscrypt okhttp core-junit bouncycastle ext
 LOCAL_STATIC_JAVA_LIBRARIES := framework-protos
 
+LOCAL_STATIC_JAVA_LIBRARIES += analytics-utils
+
 LOCAL_MODULE := framework
 
 LOCAL_DX_FLAGS := --core-library --multi-dex
index 7f1a18e..54ab947 100755 (executable)
@@ -1,3 +1,4 @@
+#!/system/bin/sh
 # Script to start "input" on the device, which has a very rudimentary
 # shell.
 #
index 754d3f5..d6be193 100644 (file)
@@ -184,9 +184,12 @@ public class Input {
         injectKeyEvent(new KeyEvent(now, now, KeyEvent.ACTION_DOWN, keyCode, 0, 0,
                 KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, inputSource));
         if (longpress) {
-            injectKeyEvent(new KeyEvent(now, now, KeyEvent.ACTION_DOWN, keyCode, 1, 0,
-                    KeyCharacterMap.VIRTUAL_KEYBOARD, 0, KeyEvent.FLAG_LONG_PRESS,
-                    inputSource));
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                throw new RuntimeException(e);
+            }
+            now = SystemClock.uptimeMillis();
         }
         injectKeyEvent(new KeyEvent(now, now, KeyEvent.ACTION_UP, keyCode, 0, 0,
                 KeyCharacterMap.VIRTUAL_KEYBOARD, 0, 0, inputSource));
index 3cb3b0b..daf5395 100644 (file)
@@ -120,6 +120,8 @@ import com.android.internal.app.ToolbarActionBar;
 import com.android.internal.app.WindowDecorActionBar;
 import com.android.internal.policy.PhoneWindow;
 
+import org.android_x86.analytics.AnalyticsHelper;
+
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.lang.annotation.Retention;
@@ -751,6 +753,7 @@ public class Activity extends ContextThemeWrapper
     boolean mFinished;
     boolean mStartedActivity;
     private boolean mDestroyed;
+    private boolean mAppsStatistics;
     private boolean mDoReportFullyDrawn = true;
     /** true if the activity is going through a transient pause */
     /*package*/ boolean mTemporaryPause = false;
@@ -963,6 +966,7 @@ public class Activity extends ContextThemeWrapper
             mVoiceInteractor.attachActivity(this);
         }
         mCalled = true;
+        mAppsStatistics = SystemProperties.getBoolean("persist.sys.apps_statistics", false);
     }
 
     /**
@@ -1187,6 +1191,12 @@ public class Activity extends ContextThemeWrapper
 
         mFragments.doLoaderStart();
 
+        // region @android-x86-analytics
+        // screen view
+        if (mAppsStatistics) {
+            AnalyticsHelper.hitScreen(this);
+        }
+        // endregion
         getApplication().dispatchActivityStarted(this);
     }
 
index acf0677..218cc37 100644 (file)
@@ -4116,6 +4116,8 @@ public class Camera {
                 return Float.parseFloat(mMap.get(key));
             } catch (NumberFormatException ex) {
                 return defaultValue;
+            } catch (NullPointerException ex) {
+                return defaultValue;
             }
         }
 
@@ -4125,6 +4127,8 @@ public class Camera {
                 return Integer.parseInt(mMap.get(key));
             } catch (NumberFormatException ex) {
                 return defaultValue;
+            } catch (NullPointerException ex) {
+                return defaultValue;
             }
         }
 
index 9114107..4497397 100644 (file)
@@ -47,6 +47,7 @@ public class DiskInfo implements Parcelable {
     public static final int FLAG_DEFAULT_PRIMARY = 1 << 1;
     public static final int FLAG_SD = 1 << 2;
     public static final int FLAG_USB = 1 << 3;
+    public static final int FLAG_CDROM = 1 << 6;
 
     public final String id;
     public final int flags;
@@ -107,6 +108,12 @@ public class DiskInfo implements Parcelable {
             } else {
                 return res.getString(com.android.internal.R.string.storage_usb_drive);
             }
+        } else if ((flags & FLAG_CDROM) != 0) {
+            if (isInteresting(label)) {
+                return res.getString(com.android.internal.R.string.storage_cdrom_label, label);
+            } else {
+                return res.getString(com.android.internal.R.string.storage_cdrom);
+            }
         } else {
             return null;
         }
index fff9d7c..4429430 100644 (file)
@@ -37,6 +37,8 @@ import java.util.TimeZone;
 import java.util.logging.LogManager;
 import org.apache.harmony.luni.internal.util.TimezoneGetter;
 
+import org.android_x86.analytics.AnalyticsHelper;
+
 /**
  * Main entry point for runtime initialization.  Not for
  * public consumption.
@@ -61,6 +63,12 @@ public class RuntimeInit {
         return Log.printlns(Log.LOG_ID_CRASH, Log.ERROR, tag, msg, tr);
     }
 
+    // region @android-x86-analytics
+    // delay 120 seconds if Analytics failed to capture exception
+    private static final long ANDROID_X86_ANALYTICS_FAILED_DELAY = 120 * 1000;
+    private static long mAnalyticsEnableTime = 0;
+    // endregion
+
     /**
      * Use this to log a message when a thread exits due to an uncaught
      * exception.  The framework catches these for the main threads, so
@@ -85,6 +93,22 @@ public class RuntimeInit {
                     message.append("PID: ").append(Process.myPid());
                     Clog_e(TAG, message.toString(), e);
                 }
+                // region @android-x86-analytics
+                if (System.currentTimeMillis() > mAnalyticsEnableTime &&
+                        SystemProperties.getBoolean("persist.sys.apps_statistics", false)) {
+                    try {
+                        AnalyticsHelper.captureException(
+                                ActivityThread.currentActivityThread().getSystemContext(),
+                                e,
+                                t.getName(),
+                                ActivityThread.currentPackageName());
+                    } catch (Throwable ex) {
+                        // delay some time to avoid endless loop exception
+                        mAnalyticsEnableTime =
+                                System.currentTimeMillis() + ANDROID_X86_ANALYTICS_FAILED_DELAY;
+                    }
+                }
+                // endregion
 
                 // Try to end profiling. If a profiler is running at this point, and we kill the
                 // process (below), the in-memory buffer will be lost. So try to stop, which will
index e4f573b..59063e8 100644 (file)
@@ -646,7 +646,8 @@ public class ZygoteInit {
             OsConstants.CAP_SYS_NICE,
             OsConstants.CAP_SYS_PTRACE,
             OsConstants.CAP_SYS_TIME,
-            OsConstants.CAP_SYS_TTY_CONFIG
+            OsConstants.CAP_SYS_TTY_CONFIG,
+            OsConstants.CAP_WAKE_ALARM
         );
         /* Containers run without this capability, so avoid setting it in that case */
         if (!SystemProperties.getBoolean(PROPERTY_RUNNING_IN_CONTAINER, false)) {
index 7d0c39c..8c2b38b 100644 (file)
@@ -45,6 +45,7 @@ bool YuvToJpegEncoder::encode(SkWStream* stream, void* inYuv, int width,
     compress(&cinfo, (uint8_t*) inYuv, offsets);
 
     jpeg_finish_compress(&cinfo);
+    jpeg_destroy_compress(&cinfo);
 
     return true;
 }
@@ -81,13 +82,19 @@ void Yuv420SpToJpegEncoder::compress(jpeg_compress_struct* cinfo,
     planes[1] = cb;
     planes[2] = cr;
 
-    int width = cinfo->image_width;
-    int height = cinfo->image_height;
+    JDIMENSION width = cinfo->image_width;
+    JDIMENSION height = cinfo->image_height;
     uint8_t* yPlanar = yuv + offsets[0];
     uint8_t* vuPlanar = yuv + offsets[1]; //width * height;
-    uint8_t* uRows = new uint8_t [8 * (width >> 1)];
-    uint8_t* vRows = new uint8_t [8 * (width >> 1)];
-
+    uint8_t* uRows = new uint8_t [8 * (((width + 15) & ~15) >> 1)];
+    uint8_t* vRows = new uint8_t [8 * (((width + 15) & ~15) >> 1)];
+    uint8_t* yRows;
+    int lastLines;
+
+    if ((height & 0xf) != 0) {
+        lastLines = height & 0xf;
+        yRows = new uint8_t [16 * ((width + 15) & ~15)];
+    }
 
     // process 16 lines of Y and 8 lines of U/V each time.
     while (cinfo->next_scanline < cinfo->image_height) {
@@ -96,8 +103,11 @@ void Yuv420SpToJpegEncoder::compress(jpeg_compress_struct* cinfo,
 
         // Jpeg library ignores the rows whose indices are greater than height.
         for (int i = 0; i < 16; i++) {
-            // y row
-            y[i] = yPlanar + (cinfo->next_scanline + i) * fStrides[0];
+            // y row. Add padding if height isn't aligned to 16 pixels.
+            if ((height & 0xf) != 0 && (cinfo->next_scanline + i) > height)
+                y[i] = &yRows[(i - lastLines) * ((width + 15) & ~15)];
+            else
+                y[i] = yPlanar + (cinfo->next_scanline + i) * fStrides[0];
 
             // construct u row and v row
             if ((i & 1) == 0) {
@@ -109,6 +119,8 @@ void Yuv420SpToJpegEncoder::compress(jpeg_compress_struct* cinfo,
           }
         jpeg_write_raw_data(cinfo, planes, 16);
     }
+    if ((height & 0xf) != 0)
+        delete [] yRows;
     delete [] uRows;
     delete [] vRows;
 
@@ -116,9 +128,12 @@ void Yuv420SpToJpegEncoder::compress(jpeg_compress_struct* cinfo,
 
 void Yuv420SpToJpegEncoder::deinterleave(uint8_t* vuPlanar, uint8_t* uRows,
         uint8_t* vRows, int rowIndex, int width, int height) {
-    int numRows = (height - rowIndex) / 2;
-    if (numRows > 8) numRows = 8;
-    for (int row = 0; row < numRows; ++row) {
+    int lines = 16;
+    //In case there isn't enough lines to process
+    if ((rowIndex + lines) > height)
+        lines = (height - rowIndex);
+
+    for (int row = 0; row < (lines >> 1); ++row) {
         int offset = ((rowIndex >> 1) + row) * fStrides[1];
         uint8_t* vu = vuPlanar + offset;
         for (int i = 0; i < (width >> 1); ++i) {
index e1ed541..837f158 100644 (file)
@@ -107,6 +107,8 @@ class FileDescriptorInfo {
     std::string file_path;
     if (!Readlink(fd, &file_path)) {
       return NULL;
+    } else if (!strncmp(file_path.c_str(), "/android/", 9)) {
+        file_path = file_path.substr(8);
     }
 
     if (!IsWhitelisted(file_path)) {
index 9c6d494..918a442 100644 (file)
     <string name="storage_sd_card_label" msgid="6347111320774379257">"<xliff:g id="MANUFACTURER">%s</xliff:g> SD 卡"</string>
     <string name="storage_usb_drive" msgid="6261899683292244209">"U 盘"</string>
     <string name="storage_usb_drive_label" msgid="4501418548927759953">"<xliff:g id="MANUFACTURER">%s</xliff:g> U 盘"</string>
+    <string name="storage_cdrom">"CD/DVD 光盘"</string>
+    <string name="storage_cdrom_label">"<xliff:g id="MANUFACTURER">%s</xliff:g> CD/DVD 光盘"</string>
     <string name="storage_usb" msgid="3017954059538517278">"USB存储器"</string>
     <string name="extract_edit_menu_button" msgid="8940478730496610137">"修改"</string>
     <string name="data_usage_warning_title" msgid="3620440638180218181">"流量消耗提醒"</string>
index 7f9b286..0b7b640 100644 (file)
     <string name="storage_sd_card_label" msgid="6347111320774379257">"<xliff:g id="MANUFACTURER">%s</xliff:g> SD 卡"</string>
     <string name="storage_usb_drive" msgid="6261899683292244209">"USB 驅動器"</string>
     <string name="storage_usb_drive_label" msgid="4501418548927759953">"<xliff:g id="MANUFACTURER">%s</xliff:g> USB 驅動器"</string>
+    <string name="storage_cdrom">"CD/DVD 光碟機"</string>
+    <string name="storage_cdrom_label">"<xliff:g id="MANUFACTURER">%s</xliff:g> CD/DVD 光碟機"</string>
     <string name="storage_usb" msgid="3017954059538517278">"USB 儲存裝置"</string>
     <string name="extract_edit_menu_button" msgid="8940478730496610137">"編輯"</string>
     <string name="data_usage_warning_title" msgid="3620440638180218181">"數據用量警告"</string>
index 7c293f0..ee8a08e 100644 (file)
     <string name="ext_media_badremoval_notification_message" msgid="380176703346946313">"請先卸載「<xliff:g id="NAME">%s</xliff:g>」,再將其移除,以免資料遺失。"</string>
     <string name="ext_media_nomedia_notification_title" msgid="1704840188641749091">"已移除「<xliff:g id="NAME">%s</xliff:g>」"</string>
     <string name="ext_media_nomedia_notification_message" msgid="6471542972147056586">"已移除「<xliff:g id="NAME">%s</xliff:g>」;請插入新的媒體"</string>
-    <string name="ext_media_unmounting_notification_title" msgid="640674168454809372">"依然退出「<xliff:g id="NAME">%s</xliff:g>」..."</string>
+    <string name="ext_media_unmounting_notification_title" msgid="640674168454809372">"正在退出「<xliff:g id="NAME">%s</xliff:g>」..."</string>
     <string name="ext_media_unmounting_notification_message" msgid="4182843895023357756">"請勿移除"</string>
     <string name="ext_media_init_action" msgid="7952885510091978278">"設定"</string>
     <string name="ext_media_unmount_action" msgid="1121883233103278199">"退出"</string>
     <string name="storage_sd_card_label" msgid="6347111320774379257">"<xliff:g id="MANUFACTURER">%s</xliff:g> SD 卡"</string>
     <string name="storage_usb_drive" msgid="6261899683292244209">"USB 隨身碟"</string>
     <string name="storage_usb_drive_label" msgid="4501418548927759953">"<xliff:g id="MANUFACTURER">%s</xliff:g> USB 隨身碟"</string>
+    <string name="storage_cdrom">"CD/DVD 光碟機"</string>
+    <string name="storage_cdrom_label">"<xliff:g id="MANUFACTURER">%s</xliff:g> CD/DVD 光碟機"</string>
     <string name="storage_usb" msgid="3017954059538517278">"USB 儲存裝置"</string>
     <string name="extract_edit_menu_button" msgid="8940478730496610137">"編輯"</string>
     <string name="data_usage_warning_title" msgid="3620440638180218181">"數據用量警告"</string>
index 4172864..4191ae0 100644 (file)
     <!-- Storage description for a USB drive from a specific manufacturer. [CHAR LIMIT=NONE] -->
     <string name="storage_usb_drive_label"><xliff:g id="manufacturer" example="Seagate">%s</xliff:g> USB drive</string>
 
+    <!-- Storage description for a generic CDROM drive. [CHAR LIMIT=NONE] -->
+    <string name="storage_cdrom">CD/DVD drive</string>
+    <!-- Storage description for a CDROM drive from a specific manufacturer. [CHAR LIMIT=NONE] -->
+    <string name="storage_cdrom_label"><xliff:g id="manufacturer" example="ASUS">%s</xliff:g> CD/DVD drive</string>
+
     <!-- Storage description for USB storage. [CHAR LIMIT=NONE] -->
     <string name="storage_usb">USB storage</string>
 
index 08ac043..14ac0de 100644 (file)
   <java-symbol type="string" name="storage_sd_card_label" />
   <java-symbol type="string" name="storage_usb_drive" />
   <java-symbol type="string" name="storage_usb_drive_label" />
+  <java-symbol type="string" name="storage_cdrom" />
+  <java-symbol type="string" name="storage_cdrom_label" />
   <java-symbol type="string" name="storage_usb" />
 
   <java-symbol type="drawable" name="ic_eject_24dp" />
index 7a4980a..56e977c 100644 (file)
@@ -109,7 +109,7 @@ public class BinderThreadPriorityTest extends AndroidTestCase {
     }
 
     public static String expectedSchedulerGroup(int prio) {
-        return prio < Process.THREAD_PRIORITY_BACKGROUND ? "/" : "/bg_non_interactive";
+        return "/";
     }
 
     public void testPassPriorityToService() throws Exception {
index 2a10bdd..79b6c85 100644 (file)
@@ -139,13 +139,13 @@ key 116   POWER
 key 117   NUMPAD_EQUALS
 # key 118 "KEY_KPPLUSMINUS"
 key 119   BREAK
-# key 120 (undefined)
+key 120   APP_SWITCH
 key 121   NUMPAD_COMMA
 key 122   KANA
 key 123   EISU
 key 124   YEN
-key 125   META_LEFT
-key 126   META_RIGHT
+key 125   HOME
+key 126   HOME
 key 127   MENU
 key 128   MEDIA_STOP
 # key 129 "KEY_AGAIN"
index da490b9..271a7b0 100644 (file)
@@ -43,13 +43,19 @@ public class MediaFile {
     public static final int FILE_TYPE_AAC     = 8;
     public static final int FILE_TYPE_MKA     = 9;
     public static final int FILE_TYPE_FLAC    = 10;
+    public static final int FILE_TYPE_3GPA    = 11;
+    public static final int FILE_TYPE_AC3     = 12;
+    public static final int FILE_TYPE_APE     = 13;
+    public static final int FILE_TYPE_WEBMA   = 14;
+    public static final int FILE_TYPE_PCM     = 15;
+    public static final int FILE_TYPE_DTS     = 16;
     private static final int FIRST_AUDIO_FILE_TYPE = FILE_TYPE_MP3;
-    private static final int LAST_AUDIO_FILE_TYPE = FILE_TYPE_FLAC;
+    private static final int LAST_AUDIO_FILE_TYPE = FILE_TYPE_DTS;
 
     // MIDI file types
-    public static final int FILE_TYPE_MID     = 11;
-    public static final int FILE_TYPE_SMF     = 12;
-    public static final int FILE_TYPE_IMY     = 13;
+    public static final int FILE_TYPE_MID     = 18;
+    public static final int FILE_TYPE_SMF     = 19;
+    public static final int FILE_TYPE_IMY     = 20;
     private static final int FIRST_MIDI_FILE_TYPE = FILE_TYPE_MID;
     private static final int LAST_MIDI_FILE_TYPE = FILE_TYPE_IMY;
 
@@ -64,8 +70,12 @@ public class MediaFile {
     public static final int FILE_TYPE_MP2TS   = 28;
     public static final int FILE_TYPE_AVI     = 29;
     public static final int FILE_TYPE_WEBM    = 30;
+    public static final int FILE_TYPE_DIVX    = 31;
+    public static final int FILE_TYPE_FLV     = 32;
+    public static final int FILE_TYPE_RV      = 33;
+    public static final int FILE_TYPE_VC1     = 34;
     private static final int FIRST_VIDEO_FILE_TYPE = FILE_TYPE_MP4;
-    private static final int LAST_VIDEO_FILE_TYPE = FILE_TYPE_WEBM;
+    private static final int LAST_VIDEO_FILE_TYPE = FILE_TYPE_VC1;
 
     // More video file types
     public static final int FILE_TYPE_MP2PS   = 200;
@@ -74,12 +84,12 @@ public class MediaFile {
     private static final int LAST_VIDEO_FILE_TYPE2 = FILE_TYPE_QT;
 
     // Image file types
-    public static final int FILE_TYPE_JPEG    = 31;
-    public static final int FILE_TYPE_GIF     = 32;
-    public static final int FILE_TYPE_PNG     = 33;
-    public static final int FILE_TYPE_BMP     = 34;
-    public static final int FILE_TYPE_WBMP    = 35;
-    public static final int FILE_TYPE_WEBP    = 36;
+    public static final int FILE_TYPE_JPEG    = 61;
+    public static final int FILE_TYPE_GIF     = 62;
+    public static final int FILE_TYPE_PNG     = 63;
+    public static final int FILE_TYPE_BMP     = 64;
+    public static final int FILE_TYPE_WBMP    = 65;
+    public static final int FILE_TYPE_WEBP    = 66;
     private static final int FIRST_IMAGE_FILE_TYPE = FILE_TYPE_JPEG;
     private static final int LAST_IMAGE_FILE_TYPE = FILE_TYPE_WEBP;
 
@@ -186,6 +196,7 @@ public class MediaFile {
         addFileType("MPGA", FILE_TYPE_MP3, "audio/mpeg", MtpConstants.FORMAT_MP3);
         addFileType("M4A", FILE_TYPE_M4A, "audio/mp4", MtpConstants.FORMAT_MPEG);
         addFileType("WAV", FILE_TYPE_WAV, "audio/x-wav", MtpConstants.FORMAT_WAV);
+        addFileType("WAV", FILE_TYPE_PCM, "audio/wav");
         addFileType("AMR", FILE_TYPE_AMR, "audio/amr");
         addFileType("AWB", FILE_TYPE_AWB, "audio/amr-wb");
         if (isWMAEnabled()) {
@@ -193,10 +204,13 @@ public class MediaFile {
         }
         addFileType("OGG", FILE_TYPE_OGG, "audio/ogg", MtpConstants.FORMAT_OGG);
         addFileType("OGG", FILE_TYPE_OGG, "application/ogg", MtpConstants.FORMAT_OGG);
+        addFileType("OGA", FILE_TYPE_OGG, "audio/ogg", MtpConstants.FORMAT_OGG);
         addFileType("OGA", FILE_TYPE_OGG, "application/ogg", MtpConstants.FORMAT_OGG);
         addFileType("AAC", FILE_TYPE_AAC, "audio/aac", MtpConstants.FORMAT_AAC);
         addFileType("AAC", FILE_TYPE_AAC, "audio/aac-adts", MtpConstants.FORMAT_AAC);
         addFileType("MKA", FILE_TYPE_MKA, "audio/x-matroska");
+        addFileType("AC3", FILE_TYPE_AC3, "audio/ac3");
+        addFileType("APE", FILE_TYPE_APE, "audio/x-ape");
 
         addFileType("MID", FILE_TYPE_MID, "audio/midi");
         addFileType("MIDI", FILE_TYPE_MID, "audio/midi");
@@ -221,7 +235,13 @@ public class MediaFile {
         addFileType("MKV", FILE_TYPE_MKV, "video/x-matroska");
         addFileType("WEBM", FILE_TYPE_WEBM, "video/webm");
         addFileType("TS", FILE_TYPE_MP2TS, "video/mp2ts");
+        addFileType("MPG", FILE_TYPE_MP2TS, "video/mp2ts");
         addFileType("AVI", FILE_TYPE_AVI, "video/avi");
+        addFileType("DIVX", FILE_TYPE_DIVX, "video/divx");
+        addFileType("FLV", FILE_TYPE_FLV, "video/x-flv");
+        addFileType("RM", FILE_TYPE_RV, "video/vnd.rn-realvideo");
+        addFileType("RMVB", FILE_TYPE_RV, "video/vnd.rn-realvideo");
+        addFileType("VC1", FILE_TYPE_VC1, "video/vc1");
 
         if (isWMVEnabled()) {
             addFileType("WMV", FILE_TYPE_WMV, "video/x-ms-wmv", MtpConstants.FORMAT_WMV);
index 0f5dd3a..0ab8805 100644 (file)
@@ -958,7 +958,7 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback
                     int a = findConfigAttrib(egl, display, config,
                             EGL10.EGL_ALPHA_SIZE, 0);
                     if ((r == mRedSize) && (g == mGreenSize)
-                            && (b == mBlueSize) && (a == mAlphaSize)) {
+                            && (b == mBlueSize) && (a >= mAlphaSize)) {
                         return config;
                     }
                 }
index f76a68c..8303c4c 100644 (file)
@@ -198,7 +198,10 @@ public class ImageWallpaper extends WallpaperService {
         @Override
         public void onDestroy() {
             super.onDestroy();
-            mBackground = null;
+            if (mBackground != null) {
+                mBackground.recycle();
+                mBackground = null;
+            }
             mWallpaperManager.forgetLoadedWallpaper();
         }
 
@@ -753,7 +756,7 @@ public class ImageWallpaper extends WallpaperService {
 
             mEglConfig = chooseEglConfig();
             if (mEglConfig == null) {
-                throw new RuntimeException("eglConfig not initialized");
+                return false;
             }
 
             mEglContext = createContext(mEgl, mEglDisplay, mEglConfig);
index e503c56..077ca4c 100644 (file)
@@ -102,6 +102,7 @@ public class RecentsTransitionHelper {
             final TaskStackView stackView, final TaskView taskView,
             final boolean screenPinningRequested, final Rect bounds, final int destinationStack) {
         final ActivityOptions opts = ActivityOptions.makeBasic();
+        opts.setLaunchStackId(destinationStack);
         if (bounds != null) {
             opts.setLaunchBounds(bounds.isEmpty() ? null : bounds);
         }
index 20cca16..3b376a6 100644 (file)
@@ -2621,6 +2621,7 @@ class AlarmManagerService extends SystemService {
                     // now trigger the alarms without the lock held
                     for (int i=0; i<triggerList.size(); i++) {
                         Alarm alarm = triggerList.get(i);
+                        if (alarm.operation == null) continue;
                         try {
                             alarm.operation.send();
                         } catch (PendingIntent.CanceledException e) {
index fcda83d..3980bc6 100644 (file)
@@ -34,9 +34,11 @@ import com.android.server.input.InputManagerService.WiredAccessoryCallbacks;
 import static com.android.server.input.InputManagerService.SW_HEADPHONE_INSERT;
 import static com.android.server.input.InputManagerService.SW_MICROPHONE_INSERT;
 import static com.android.server.input.InputManagerService.SW_LINEOUT_INSERT;
+import static com.android.server.input.InputManagerService.SW_VIDEOOUT_INSERT;
 import static com.android.server.input.InputManagerService.SW_HEADPHONE_INSERT_BIT;
 import static com.android.server.input.InputManagerService.SW_MICROPHONE_INSERT_BIT;
 import static com.android.server.input.InputManagerService.SW_LINEOUT_INSERT_BIT;
+import static com.android.server.input.InputManagerService.SW_VIDEOOUT_INSERT_BIT;
 
 import java.io.File;
 import java.io.FileReader;
@@ -111,8 +113,11 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {
             if (mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY, SW_LINEOUT_INSERT) == 1) {
                 switchValues |= SW_LINEOUT_INSERT_BIT;
             }
+            if (mInputManager.getSwitchState(-1, InputDevice.SOURCE_ANY, SW_VIDEOOUT_INSERT) == 1) {
+                switchValues |= SW_VIDEOOUT_INSERT_BIT;
+            }
             notifyWiredAccessoryChanged(0, switchValues,
-                    SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_LINEOUT_INSERT_BIT);
+                    SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_LINEOUT_INSERT_BIT | SW_VIDEOOUT_INSERT_BIT);
         }
 
         mObserver.init();
@@ -120,7 +125,7 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {
 
     @Override
     public void notifyWiredAccessoryChanged(long whenNanos, int switchValues, int switchMask) {
-        if (LOG) Slog.v(TAG, "notifyWiredAccessoryChanged: when=" + whenNanos
+        if (LOG) Slog.i(TAG, "notifyWiredAccessoryChanged: when=" + whenNanos
                 + " bits=" + switchCodeToString(switchValues, switchMask)
                 + " mask=" + Integer.toHexString(switchMask));
 
@@ -128,7 +133,7 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {
             int headset;
             mSwitchValues = (mSwitchValues & ~switchMask) | switchValues;
             switch (mSwitchValues &
-                (SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_LINEOUT_INSERT_BIT)) {
+                (SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_LINEOUT_INSERT_BIT | SW_VIDEOOUT_INSERT_BIT)) {
                 case 0:
                     headset = 0;
                     break;
@@ -141,6 +146,11 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {
                     headset = BIT_LINEOUT;
                     break;
 
+                case SW_VIDEOOUT_INSERT_BIT:
+                case SW_VIDEOOUT_INSERT_BIT | SW_LINEOUT_INSERT_BIT:
+                    headset = BIT_HDMI_AUDIO;
+                    break;
+
                 case SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT:
                     headset = BIT_HEADSET;
                     break;
@@ -155,7 +165,7 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {
             }
 
             updateLocked(NAME_H2W,
-                (mHeadsetState & ~(BIT_HEADSET | BIT_HEADSET_NO_MIC | BIT_LINEOUT)) | headset);
+                (mHeadsetState & ~(BIT_HEADSET | BIT_HEADSET_NO_MIC | BIT_LINEOUT | BIT_HDMI_AUDIO)) | headset);
         }
     }
 
@@ -285,7 +295,7 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {
             }
 
             if (LOG) {
-                Slog.v(TAG, "headsetName: " + headsetName +
+                Slog.i(TAG, "headsetName: " + headsetName +
                         (state == 1 ? " connected" : " disconnected"));
             }
 
@@ -308,6 +318,14 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {
                 (switchValues & SW_MICROPHONE_INSERT_BIT) != 0) {
             sb.append("SW_MICROPHONE_INSERT");
         }
+        if ((switchMask & SW_LINEOUT_INSERT_BIT) != 0 &&
+                (switchValues & SW_LINEOUT_INSERT_BIT) != 0) {
+            sb.append("SW_LINEOUT_INSERT ");
+        }
+        if ((switchMask & SW_VIDEOOUT_INSERT_BIT) != 0 &&
+                (switchValues & SW_VIDEOOUT_INSERT_BIT) != 0) {
+            sb.append("SW_VIDEOOUT_INSERT ");
+        }
         return sb.toString();
     }
 
index 9c762cc..d58e9ed 100644 (file)
@@ -372,7 +372,9 @@ public final class DisplayManagerService extends SystemService {
                             + ", brightness=" + brightness + ")");
                     mGlobalDisplayState = state;
                     mGlobalDisplayBrightness = brightness;
-                    applyGlobalDisplayStateLocked(mTempDisplayStateWorkQueue);
+                    if (state != Display.STATE_OFF) {
+                        applyGlobalDisplayStateLocked(mTempDisplayStateWorkQueue);
+                    }
                 }
 
                 // Setting the display power state can take hundreds of milliseconds
index 719ce76..49771e2 100644 (file)
@@ -66,6 +66,7 @@ import android.hardware.input.TouchCalibration;
 import android.os.Binder;
 import android.os.Bundle;
 import android.os.Environment;
+import android.os.FileObserver;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Looper;
@@ -283,6 +284,9 @@ public class InputManagerService extends IInputManager.Stub
     /** Switch code: Headphone/Microphone Jack.  When set, something is inserted. */
     public static final int SW_JACK_PHYSICAL_INSERT = 0x07;
 
+    /** Switch code: Video out jack.  When set, something is inserted. */
+    public static final int SW_VIDEOOUT_INSERT = 0x08;
+
     /** Switch code: Camera lens cover. When set the lens is covered. */
     public static final int SW_CAMERA_LENS_COVER = 0x09;
 
@@ -293,13 +297,27 @@ public class InputManagerService extends IInputManager.Stub
     public static final int SW_MICROPHONE_INSERT_BIT = 1 << SW_MICROPHONE_INSERT;
     public static final int SW_LINEOUT_INSERT_BIT = 1 << SW_LINEOUT_INSERT;
     public static final int SW_JACK_PHYSICAL_INSERT_BIT = 1 << SW_JACK_PHYSICAL_INSERT;
+    public static final int SW_VIDEOOUT_INSERT_BIT = 1 << SW_VIDEOOUT_INSERT;
     public static final int SW_JACK_BITS =
-            SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_JACK_PHYSICAL_INSERT_BIT | SW_LINEOUT_INSERT_BIT;
+            SW_HEADPHONE_INSERT_BIT | SW_MICROPHONE_INSERT_BIT | SW_JACK_PHYSICAL_INSERT_BIT | SW_LINEOUT_INSERT_BIT | SW_VIDEOOUT_INSERT_BIT;
     public static final int SW_CAMERA_LENS_COVER_BIT = 1 << SW_CAMERA_LENS_COVER;
 
     /** Whether to use the dev/input/event or uevent subsystem for the audio jack. */
     final boolean mUseDevInputEventForAudioJack;
 
+    private class TscalObserver extends FileObserver {
+        public TscalObserver() {
+            super("/data/misc/tscal/pointercal", CLOSE_WRITE);
+        }
+
+        @Override
+        public void onEvent(int event, String path) {
+            Slog.i(TAG, "detect pointercal changed");
+            reloadDeviceAliases();
+        }
+    }
+    private final TscalObserver mTscalObserver = new TscalObserver();
+
     public InputManagerService(Context context) {
         this.mContext = context;
         this.mHandler = new InputManagerHandler(DisplayThread.get().getLooper());
@@ -316,6 +334,7 @@ public class InputManagerService extends IInputManager.Stub
             new File(doubleTouchGestureEnablePath);
 
         LocalServices.addService(InputManagerInternal.class, new LocalService());
+        mTscalObserver.startWatching();
     }
 
     public void setWindowManagerCallbacks(WindowManagerCallbacks callbacks) {
index 889c52a..bcbe93c 100644 (file)
@@ -2020,7 +2020,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
 
         // Only force the default orientation if the screen is xlarge, at least 960dp x 720dp, per
         // http://developer.android.com/guide/practices/screens_support.html#range
-        mForceDefaultOrientation = longSizeDp >= 960 && shortSizeDp >= 720 &&
+        mForceDefaultOrientation = /* longSizeDp >= 960 && shortSizeDp >= 720 && */
                 res.getBoolean(com.android.internal.R.bool.config_forceDefaultOrientation) &&
                 // For debug purposes the next line turns this feature off with:
                 // $ adb shell setprop config.override_forced_orient true
index 1015a20..7a785b9 100644 (file)
@@ -235,10 +235,11 @@ class DisplayContent {
                 || orientation == Surface.ROTATION_270);
         final int physWidth = rotated ? mBaseDisplayHeight : mBaseDisplayWidth;
         final int physHeight = rotated ? mBaseDisplayWidth : mBaseDisplayHeight;
+        boolean forcedOrientation = mService.mPolicy.isDefaultOrientationForced();
         int width = mDisplayInfo.logicalWidth;
-        int left = (physWidth - width) / 2;
+        int left = forcedOrientation ? 0 : (physWidth - width) / 2;
         int height = mDisplayInfo.logicalHeight;
-        int top = (physHeight - height) / 2;
+        int top = forcedOrientation ? 0 : (physHeight - height) / 2;
         out.set(left, top, left + width, top + height);
     }
 
index 228ef1a..c0dd8da 100644 (file)
@@ -1689,7 +1689,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
 
     int getTouchableRegion(Region region, int flags) {
         final boolean modal = (flags & (FLAG_NOT_TOUCH_MODAL | FLAG_NOT_FOCUSABLE)) == 0;
-        if (modal && mAppToken != null) {
+        if (modal && mAppToken != null && !mAppToken.appFullscreen) {
             // Limit the outer touch to the activity stack region.
             flags |= FLAG_NOT_TOUCH_MODAL;
             // If this is a modal window we need to dismiss it if it's not full screen and the
index 246ab0d..e61298e 100644 (file)
@@ -39,6 +39,7 @@
 #include <linux/ioctl.h>
 #include <linux/android_alarm.h>
 #include <linux/rtc.h>
+#include <cutils/properties.h>
 
 #include <memory>
 
@@ -165,7 +166,7 @@ int AlarmImplTimerFd::set(int type, struct timespec *ts)
 int AlarmImplTimerFd::setTime(struct timeval *tv)
 {
     struct rtc_time rtc;
-    struct tm tm, *gmtime_res;
+    struct tm tm, *localtime_res, *gmtime_res;
     int fd;
     int res;
 
@@ -188,11 +189,23 @@ int AlarmImplTimerFd::setTime(struct timeval *tv)
         return res;
     }
 
-    gmtime_res = gmtime_r(&tv->tv_sec, &tm);
-    if (!gmtime_res) {
-        ALOGV("gmtime_r() failed: %s\n", strerror(errno));
-        res = -1;
-        goto done;
+    // @jide when persist.rtc_local_time is set to 1, we store the localtime to rtc
+    //
+    bool rtc_local_time = property_get_bool("persist.rtc_local_time", false);
+    if (rtc_local_time) {
+        localtime_res = localtime_r(&tv->tv_sec, &tm);
+        if (!localtime_res) {
+            ALOGV("localtime_r() failed: %s\n", strerror(errno));
+            res = -1;
+            goto done;
+        }
+    } else {
+        gmtime_res = gmtime_r(&tv->tv_sec, &tm);
+        if (!gmtime_res) {
+            ALOGV("gmtime_r() failed: %s\n", strerror(errno));
+            res = -1;
+            goto done;
+        }
     }
 
     memset(&rtc, 0, sizeof(rtc));