Advertisement
arter97

Untitled

Sep 3rd, 2016
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.12 KB | None | 0 0
  1. diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
  2. index 782dc46..49d639d 100644
  3. --- a/core/java/android/app/ActivityThread.java
  4. +++ b/core/java/android/app/ActivityThread.java
  5. @@ -1662,6 +1662,21 @@ public final class ActivityThread {
  6.          return (sCurrentActivityThread != null) ? sCurrentActivityThread.mSystemThread : false;
  7.      }
  8.  
  9. +    public static int isSystemApp() {
  10. +        ApplicationInfo ai = null;
  11. +
  12. +        try {
  13. +            ai = getPackageManager().getApplicationInfo(currentOpPackageName(), 0, UserHandle.myUserId());
  14. +        } catch (RemoteException e) {
  15. +            return -1;
  16. +        }
  17. +
  18. +        if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0)
  19. +            return 1;
  20. +        else
  21. +            return 0;
  22. +    }
  23. +
  24.      public static String currentOpPackageName() {
  25.          ActivityThread am = currentActivityThread();
  26.          return (am != null && am.getApplication() != null)
  27. diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
  28. index dd15d38..6bda753 100644
  29. --- a/core/java/android/hardware/Camera.java
  30. +++ b/core/java/android/hardware/Camera.java
  31. @@ -20,6 +20,7 @@ import android.app.ActivityThread;
  32.  import android.annotation.SdkConstant;
  33.  import android.annotation.SdkConstant.SdkConstantType;
  34.  import android.content.Context;
  35. +import android.content.pm.PackageManager;
  36.  import android.graphics.ImageFormat;
  37.  import android.graphics.Point;
  38.  import android.graphics.Rect;
  39. @@ -486,7 +487,11 @@ public class Camera {
  40.  
  41.          String packageName = ActivityThread.currentOpPackageName();
  42.  
  43. -        //Force HAL1 if the package name falls in this bucket
  44. +        // Force HAL1 for all user apps
  45. +        if (ActivityThread.isSystemApp() == 0)
  46. +            halVersion = CAMERA_HAL_API_VERSION_1_0;
  47. +
  48. +        // Force HAL1 if the package is system app and its name falls in this bucket
  49.          String packageList = SystemProperties.get("camera.hal1.packagelist", "");
  50.          if (packageList.length() > 0) {
  51.              TextUtils.StringSplitter splitter = new TextUtils.SimpleStringSplitter(',');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement