Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2537932f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "No camera for idle uids - framework"

parents 93eb9243 82f09bcf
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -1325,6 +1325,25 @@ public class AppOpsManager {
        return sOpDefaultMode[op];
    }

    /**
     * Retrieve the human readable mode.
     * @hide
     */
    public static String modeToString(int mode) {
        switch (mode) {
            case MODE_ALLOWED:
                return "allow";
            case MODE_IGNORED:
                return "ignore";
            case MODE_ERRORED:
                return "deny";
            case MODE_DEFAULT:
                return "default";
            default:
                return "mode=" + mode;
        }
    }

    /**
     * Retrieve whether the op allows itself to be reset.
     * @hide
+22 −22
Original line number Diff line number Diff line
@@ -16,9 +16,8 @@

package android.hardware.camera2.impl;

import static android.hardware.camera2.CameraAccessException.CAMERA_IN_USE;
import static com.android.internal.util.function.pooled.PooledLambda.obtainRunnable;

import android.graphics.ImageFormat;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraCharacteristics;
@@ -31,7 +30,6 @@ import android.hardware.camera2.ICameraDeviceUser;
import android.hardware.camera2.TotalCaptureResult;
import android.hardware.camera2.params.InputConfiguration;
import android.hardware.camera2.params.OutputConfiguration;
import android.hardware.camera2.params.ReprocessFormatsMap;
import android.hardware.camera2.params.SessionConfiguration;
import android.hardware.camera2.params.StreamConfigurationMap;
import android.hardware.camera2.utils.SubmitInfo;
@@ -1798,31 +1796,33 @@ public class CameraDeviceImpl extends CameraDevice
                    case ERROR_CAMERA_DISCONNECTED:
                        CameraDeviceImpl.this.mDeviceHandler.post(mCallOnDisconnected);
                        break;
                    default:
                        Log.e(TAG, "Unknown error from camera device: " + errorCode);
                        // no break
                    case ERROR_CAMERA_DEVICE:
                    case ERROR_CAMERA_SERVICE:
                        mInError = true;
                        final int publicErrorCode = (errorCode == ERROR_CAMERA_DEVICE) ?
                                StateCallback.ERROR_CAMERA_DEVICE :
                                StateCallback.ERROR_CAMERA_SERVICE;
                        Runnable r = new Runnable() {
                            @Override
                            public void run() {
                                if (!CameraDeviceImpl.this.isClosed()) {
                                    mDeviceCallback.onError(CameraDeviceImpl.this, publicErrorCode);
                                }
                            }
                        };
                        CameraDeviceImpl.this.mDeviceHandler.post(r);
                        break;
                    case ERROR_CAMERA_REQUEST:
                    case ERROR_CAMERA_RESULT:
                    case ERROR_CAMERA_BUFFER:
                        onCaptureErrorLocked(errorCode, resultExtras);
                        break;
                    case ERROR_CAMERA_DEVICE:
                        scheduleNotifyError(StateCallback.ERROR_CAMERA_DEVICE);
                        break;
                    case ERROR_CAMERA_DISABLED:
                        scheduleNotifyError(StateCallback.ERROR_CAMERA_DISABLED);
                        break;
                    default:
                        Log.e(TAG, "Unknown error from camera device: " + errorCode);
                        scheduleNotifyError(StateCallback.ERROR_CAMERA_SERVICE);
                }
            }
        }

        private void scheduleNotifyError(int code) {
            mInError = true;
            CameraDeviceImpl.this.mDeviceHandler.post(obtainRunnable(
                    CameraDeviceCallbacks::notifyError, this, code));
        }

        private void notifyError(int code) {
            if (!CameraDeviceImpl.this.isClosed()) {
                mDeviceCallback.onError(CameraDeviceImpl.this, code);
            }
        }

+5 −0
Original line number Diff line number Diff line
@@ -3711,6 +3711,11 @@
    <permission android:name="android.permission.MODIFY_QUIET_MODE"
                android:protectionLevel="signature|privileged" />

    <!-- Allows internal management of the camera framework
         @hide -->
    <permission android:name="android.permission.MANAGE_CAMERA"
        android:protectionLevel="signature" />

    <!-- Allows an application to control remote animations. See
         {@link ActivityOptions#makeRemoteAnimation}
         @hide <p>Not for use by third-party applications. -->
+1 −0
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@
    <assign-permission name="android.permission.UPDATE_DEVICE_STATS" uid="cameraserver" />
    <assign-permission name="android.permission.UPDATE_APP_OPS_STATS" uid="cameraserver" />
    <assign-permission name="android.permission.GET_PROCESS_STATE_AND_OOM_SCORE" uid="cameraserver" />
    <assign-permission name="android.permission.PACKAGE_USAGE_STATS" uid="cameraserver" />

    <assign-permission name="android.permission.ACCESS_SURFACE_FLINGER" uid="graphics" />

+1 −1
Original line number Diff line number Diff line
@@ -136,8 +136,8 @@
    <uses-permission android:name="android.permission.MANAGE_BIND_INSTANT_SERVICE" />
    <uses-permission android:name="android.permission.SET_HARMFUL_APP_WARNINGS" />
    <uses-permission android:name="android.permission.MANAGE_SENSORS" />

    <uses-permission android:name="android.permission.MANAGE_AUDIO_POLICY" />
    <uses-permission android:name="android.permission.MANAGE_CAMERA" />

    <application android:label="@string/app_label"
                 android:defaultToDeviceProtectedStorage="true"
Loading