From 54bd7b85b2e3c8c43e9d710d4b592921c96c3846 Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Tue, 16 Aug 2016 16:03:44 -0700 Subject: DO NOT MERGE Isolated processes don't get precached system service binders More specifically, they get a PackageManager binder -- necessary for Android process startup and configuration -- but none of the other usual preloaded service binders. CYNGNOS-3312 Bug 30202228 Change-Id: I3810649f504cd631665ece338a83d2e54d41ad05 (cherry picked from commit 2c61c57ac53cbb270b4e76b9d04465f8a3f6eadc) (cherry picked from commit f4d23f30c92bc80808f57677caab0282c8d28dc6) (cherry picked from commit 9357830a380c8174ce5130941a7a53915d680819) --- .../android/server/am/ActivityManagerService.java | 25 ++++++++++++++-------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 30f35af..23f34e6 100755 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -1030,6 +1030,7 @@ public final class ActivityManagerService extends ActivityManagerNative * For example, references to the commonly used services. */ HashMap mAppBindArgs; + HashMap mIsolatedAppBindArgs; /** * Temporary to avoid allocations. Protected by main lock. @@ -2831,18 +2832,24 @@ public final class ActivityManagerService extends ActivityManagerNative * lazily setup to make sure the services are running when they're asked for. */ private HashMap getCommonServicesLocked(boolean isolated) { + // Isolated processes won't get this optimization, so that we don't + // violate the rules about which services they have access to. + if (isolated) { + if (mIsolatedAppBindArgs == null) { + mIsolatedAppBindArgs = new HashMap<>(); + mIsolatedAppBindArgs.put("package", ServiceManager.getService("package")); + } + return mIsolatedAppBindArgs; + } + if (mAppBindArgs == null) { mAppBindArgs = new HashMap<>(); - // Isolated processes won't get this optimization, so that we don't - // violate the rules about which services they have access to. - if (!isolated) { - // Setup the application init args - mAppBindArgs.put("package", ServiceManager.getService("package")); - mAppBindArgs.put("window", ServiceManager.getService("window")); - mAppBindArgs.put(Context.ALARM_SERVICE, - ServiceManager.getService(Context.ALARM_SERVICE)); - } + // Setup the application init args + mAppBindArgs.put("package", ServiceManager.getService("package")); + mAppBindArgs.put("window", ServiceManager.getService("window")); + mAppBindArgs.put(Context.ALARM_SERVICE, + ServiceManager.getService(Context.ALARM_SERVICE)); } return mAppBindArgs; } -- cgit v1.1 From 596ffb80bb55a91f80a029c947d09f0911c616a3 Mon Sep 17 00:00:00 2001 From: Sungsoo Date: Tue, 18 Oct 2016 14:12:00 +0900 Subject: DO NOT MERGE) ExifInterface: Close the file when an exception happens CYNGNOS-3312 Bug: 32068647, Bug: 30936376 Change-Id: I22fa2384348c890ca726d2b1632cd54e59d25a8f (cherry picked from commit cb17930077de640411407636eebc000e2d06dd9c) (cherry picked from commit 2c79cada8897dcb171b8227b4ea91c292400702f) --- media/java/android/media/ExifInterface.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/media/java/android/media/ExifInterface.java b/media/java/android/media/ExifInterface.java index a2ccdc8..bb75547 100644 --- a/media/java/android/media/ExifInterface.java +++ b/media/java/android/media/ExifInterface.java @@ -1335,8 +1335,9 @@ public class ExifInterface { for (int i = 0; i < EXIF_TAGS.length; ++i) { mAttributes[i] = new HashMap(); } + InputStream in = null; try { - InputStream in = new FileInputStream(mFilename); + in = new FileInputStream(mFilename); getJpegAttributes(in); mIsSupportedFile = true; } catch (IOException e) { @@ -1349,6 +1350,7 @@ public class ExifInterface { if (DEBUG) { printAttributes(); } + IoUtils.closeQuietly(in); } } -- cgit v1.1