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

Commit 37fc9bb0 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7620055 from ccdd40e5 to sc-release

Change-Id: I99c75cd7da62b02054926858524de6472de90d5f
parents b845defe ccdd40e5
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ public class FullBackup {
        ConfigSection.CLOUD_BACKUP,
        ConfigSection.DEVICE_TRANSFER
    })
    private @interface ConfigSection {
    @interface ConfigSection {
        String CLOUD_BACKUP = "cloud-backup";
        String DEVICE_TRANSFER = "device-transfer";
    }
@@ -528,7 +528,8 @@ public class FullBackup {
            return mExcludes;
        }

        private synchronized int getRequiredTransportFlags()
        @VisibleForTesting
        public synchronized int getRequiredTransportFlags()
                throws IOException, XmlPullParserException {
            if (mRequiredTransportFlags == null) {
                maybeParseBackupSchemeLocked();
@@ -587,11 +588,13 @@ public class FullBackup {
            if (mDataExtractionRules != 0) {
                // New config is present. Use it if it has configuration for this operation
                // type.
                boolean isSectionPresent;
                try (XmlResourceParser parser = getParserForResource(mDataExtractionRules)) {
                    parseNewBackupSchemeFromXmlLocked(parser, configSection, mExcludes, mIncludes);
                    isSectionPresent = parseNewBackupSchemeFromXmlLocked(parser, configSection,
                            mExcludes, mIncludes);
                }
                if (!mExcludes.isEmpty() || !mIncludes.isEmpty()) {
                    // Found configuration in the new config, we will use it.
                if (isSectionPresent) {
                    // Found the relevant section in the new config, we will use it.
                    mIsUsingNewScheme = true;
                    return;
                }
@@ -630,24 +633,31 @@ public class FullBackup {
                    .getXml(resourceId);
        }

        private void parseNewBackupSchemeFromXmlLocked(XmlPullParser parser,
        @VisibleForTesting
        public boolean parseNewBackupSchemeFromXmlLocked(XmlPullParser parser,
                @ConfigSection  String configSection,
                Set<PathWithRequiredFlags> excludes,
                Map<String, Set<PathWithRequiredFlags>> includes)
                throws IOException, XmlPullParserException {
            verifyTopLevelTag(parser, "data-extraction-rules");

            boolean isSectionPresent = false;

            int event;
            while ((event = parser.next()) != XmlPullParser.END_DOCUMENT) {
                if (event != XmlPullParser.START_TAG || !configSection.equals(parser.getName())) {
                    continue;
                }

                isSectionPresent = true;

                parseRequiredTransportFlags(parser, configSection);
                parseRules(parser, excludes, includes, Optional.of(0), configSection);
            }

            logParsingResults(excludes, includes);

            return isSectionPresent;
        }

        private void parseRequiredTransportFlags(XmlPullParser parser,
+17 −18
Original line number Diff line number Diff line
@@ -446,16 +446,12 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes
        }
    }

    @Override
    protected void finalize() throws Throwable {
        if (mHandlerThread != null) {
            mHandlerThread.quitSafely();
        }
        super.finalize();
    }
    public void release(boolean skipCloseNotification) {
        boolean notifyClose = false;

    public void release() {
        synchronized (mInterfaceLock) {
            mHandlerThread.quitSafely();

            if (mSessionProcessor != null) {
                try {
                    mSessionProcessor.deInitSession();
@@ -469,6 +465,7 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes
            if (mExtensionClientId >= 0) {
                CameraExtensionCharacteristics.unregisterClient(mExtensionClientId);
                if (mInitialized) {
                    notifyClose = true;
                    CameraExtensionCharacteristics.releaseSession();
                }
            }
@@ -482,6 +479,16 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes
            mClientRepeatingRequestSurface = null;
            mClientCaptureSurface = null;
        }

        if (notifyClose && !skipCloseNotification) {
            final long ident = Binder.clearCallingIdentity();
            try {
                mExecutor.execute(() -> mCallbacks.onClosed(
                        CameraAdvancedExtensionSessionImpl.this));
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
        }
    }

    private void notifyConfigurationFailure() {
@@ -491,7 +498,7 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes
            }
        }

        release();
        release(true /*skipCloseNotification*/);

        final long ident = Binder.clearCallingIdentity();
        try {
@@ -507,15 +514,7 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes
            android.hardware.camera2.CameraCaptureSession.StateCallback {
        @Override
        public void onClosed(@NonNull CameraCaptureSession session) {
            release();

            final long ident = Binder.clearCallingIdentity();
            try {
                mExecutor.execute(() -> mCallbacks.onClosed(
                       CameraAdvancedExtensionSessionImpl.this));
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
            release(false /*skipCloseNotification*/);
        }

        @Override
+4 −4
Original line number Diff line number Diff line
@@ -697,12 +697,12 @@ public class CameraDeviceImpl extends CameraDevice
            }

            if (mCurrentExtensionSession != null) {
                mCurrentExtensionSession.release();
                mCurrentExtensionSession.release(false /*skipCloseNotification*/);
                mCurrentExtensionSession = null;
            }

            if (mCurrentAdvancedExtensionSession != null) {
                mCurrentAdvancedExtensionSession.release();
                mCurrentAdvancedExtensionSession.release(false /*skipCloseNotification*/);
                mCurrentAdvancedExtensionSession = null;
            }

@@ -1352,12 +1352,12 @@ public class CameraDeviceImpl extends CameraDevice
            }

            if (mCurrentExtensionSession != null) {
                mCurrentExtensionSession.release();
                mCurrentExtensionSession.release(true /*skipCloseNotification*/);
                mCurrentExtensionSession = null;
            }

            if (mCurrentAdvancedExtensionSession != null) {
                mCurrentAdvancedExtensionSession.release();
                mCurrentAdvancedExtensionSession.release(true /*skipCloseNotification*/);
                mCurrentAdvancedExtensionSession = null;
            }

+16 −18
Original line number Diff line number Diff line
@@ -630,18 +630,13 @@ public final class CameraExtensionSessionImpl extends CameraExtensionSession {
                new CameraExtensionUtils.HandlerExecutor(mHandler), requestHandler);
    }

    @Override
    protected void finalize() throws Throwable {
        if (mHandlerThread != null) {
            mHandlerThread.quitSafely();
        }
        super.finalize();
    }

    /** @hide */
    public void release() {
    public void release(boolean skipCloseNotification) {
        boolean notifyClose = false;

        synchronized (mInterfaceLock) {
            mInternalRepeatingRequestEnabled = false;
            mHandlerThread.quitSafely();

            try {
                mPreviewExtender.onDeInit();
@@ -654,6 +649,7 @@ public final class CameraExtensionSessionImpl extends CameraExtensionSession {
            if (mExtensionClientId >= 0) {
                CameraExtensionCharacteristics.unregisterClient(mExtensionClientId);
                if (mInitialized) {
                    notifyClose = true;
                    CameraExtensionCharacteristics.releaseSession();
                }
            }
@@ -704,6 +700,15 @@ public final class CameraExtensionSessionImpl extends CameraExtensionSession {
            mCameraRepeatingSurface = mClientRepeatingRequestSurface = null;
            mCameraBurstSurface = mClientCaptureSurface = null;
        }

        if (notifyClose && !skipCloseNotification) {
            final long ident = Binder.clearCallingIdentity();
            try {
                mExecutor.execute(() -> mCallbacks.onClosed(CameraExtensionSessionImpl.this));
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
        }
    }

    private void notifyConfigurationFailure() {
@@ -713,7 +718,7 @@ public final class CameraExtensionSessionImpl extends CameraExtensionSession {
            }
        }

        release();
        release(true /*skipCloseNotification*/);

        final long ident = Binder.clearCallingIdentity();
        try {
@@ -745,14 +750,7 @@ public final class CameraExtensionSessionImpl extends CameraExtensionSession {
            android.hardware.camera2.CameraCaptureSession.StateCallback {
        @Override
        public void onClosed(@NonNull CameraCaptureSession session) {
            release();

            final long ident = Binder.clearCallingIdentity();
            try {
                mExecutor.execute(() -> mCallbacks.onClosed(CameraExtensionSessionImpl.this));
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
            release(false /*skipCloseNotification*/);
        }

        @Override
+3 −0
Original line number Diff line number Diff line
@@ -783,6 +783,9 @@ public class AlwaysOnHotwordDetector extends AbstractHotwordDetector {
     *         This may happen if another detector has been instantiated or the
     *         {@link VoiceInteractionService} hosting this detector has been shut down.
     */
    // TODO: Remove this RequiresPermission since it isn't actually enforced. Also fix the javadoc
    // about permissions enforcement (when it throws vs when it just returns false) for other
    // methods in this class.
    @RequiresPermission(allOf = {RECORD_AUDIO, CAPTURE_AUDIO_HOTWORD})
    @Override
    public boolean stopRecognition() {
Loading