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

Commit 8bae5bc2 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7451737 from 41b61007 to sc-release

Change-Id: Ib89cc99c9aa68396e99515d42235946f39d28841
parents 9b5f20a8 41b61007
Loading
Loading
Loading
Loading
+26 −10
Original line number Diff line number Diff line
@@ -33,10 +33,13 @@ import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
import android.util.Log;

import com.android.internal.util.function.pooled.PooledLambda;

import java.lang.ref.WeakReference;
import java.util.Objects;

@@ -225,6 +228,27 @@ public abstract class RecognitionService extends Service {
     */
    protected abstract void onStopListening(Callback listener);

    @Override
    public Context createContext(@NonNull ContextParams contextParams) {
        if (contextParams.getNextAttributionSource() != null) {
            if (mHandler.getLooper().equals(Looper.myLooper())) {
                handleAttributionContextCreation(contextParams.getNextAttributionSource());
            } else {
                mHandler.sendMessage(
                        PooledLambda.obtainMessage(this::handleAttributionContextCreation,
                                contextParams.getNextAttributionSource()));
            }
        }
        return super.createContext(contextParams);
    }

    private void handleAttributionContextCreation(@NonNull AttributionSource attributionSource) {
        if (mCurrentCallback != null
                && mCurrentCallback.mCallingAttributionSource.equals(attributionSource)) {
            mCurrentCallback.mAttributionContextCreated = true;
        }
    }

    @Override
    public final IBinder onBind(final Intent intent) {
        if (DBG) Log.d(TAG, "onBind, intent=" + intent);
@@ -249,6 +273,7 @@ public abstract class RecognitionService extends Service {
        private final IRecognitionListener mListener;
        private final @NonNull AttributionSource mCallingAttributionSource;
        private @Nullable Context mAttributionContext;
        private boolean mAttributionContextCreated;

        private Callback(IRecognitionListener listener,
                @NonNull AttributionSource attributionSource) {
@@ -421,7 +446,7 @@ public abstract class RecognitionService extends Service {
    }

    private boolean checkPermissionAndStartDataDelivery() {
        if (isPerformingDataDelivery()) {
        if (mCurrentCallback.mAttributionContextCreated) {
            return true;
        }
        if (PermissionChecker.checkPermissionAndStartDataDelivery(
@@ -441,13 +466,4 @@ public abstract class RecognitionService extends Service {
                    mCurrentCallback.getAttributionContextForCaller().getAttributionSource());
        }
    }

    @SuppressWarnings("ConstantCondition")
    private boolean isPerformingDataDelivery() {
        final int op = AppOpsManager.permissionToOpCode(Manifest.permission.RECORD_AUDIO);
        final AppOpsManager appOpsManager = getSystemService(AppOpsManager.class);
        return appOpsManager.isProxying(op, getAttributionTag(),
                mCurrentCallback.getCallingAttributionSource().getUid(),
                mCurrentCallback.getCallingAttributionSource().getPackageName());
    }
}
+6 −9
Original line number Diff line number Diff line
@@ -108,16 +108,13 @@ public class AdapterStateListener extends IUwbAdapterStateCallbacks.Stub {
     */
    public void setEnabled(boolean isEnabled) {
        synchronized (this) {
            if (!mIsRegistered) {
                return;
            } else {
            try {
                mAdapter.setEnabled(isEnabled);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed to set adapter state");
                throw e.rethrowFromSystemServer();
            }
            }

        }
    }

+8 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="month_day_year">%-e %B %Y</string>
    <string name="time_of_day">%H:%M:%S</string>
    <string name="date_and_time">%-e %b %Y, %H:%M:%S</string>
    <string name="date_time">%1$s, %2$s</string>
</resources>
+8 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="month_day_year">%-e %B %Y</string>
    <string name="time_of_day">%H:%M:%S</string>
    <string name="date_and_time">%-e %b %Y, %H:%M:%S</string>
    <string name="date_time">%1$s, %2$s</string>
</resources>
+8 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="month_day_year">%-e %B %Y</string>
    <string name="time_of_day">%H:%M:%S</string>
    <string name="date_and_time">%-e %b %Y, %H:%M:%S</string>
    <string name="date_time">%1$s, %2$s</string>
</resources>
Loading