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

Commit 9e16857c authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6966897 from 6ca71a16 to rvc-qpr2-release

Change-Id: Id24498f5f9ec4f2a7fa390411ebdbcdca3b7afb9
parents 39c90ea9 6ca71a16
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -1186,11 +1186,10 @@ public final class MediaParser {
            // TODO: For efficiency, the same implementation should be used, by providing a
            // clearBuffers() method, or similar.
            long resourceLength = seekableInputReader.getLength();
            if (resourceLength == -1) {
                mResourceByteCount = -1;
            }
            if (mResourceByteCount != -1) {
                mResourceByteCount += resourceLength;
            if (mResourceByteCount == 0) {
                // For resource byte count metric collection, we only take into account the length
                // of the first provided input reader.
                mResourceByteCount = resourceLength;
            }
            mExtractorInput =
                    new DefaultExtractorInput(
+9 −28
Original line number Diff line number Diff line
@@ -16,23 +16,16 @@
package android.accounts;

import android.app.Activity;
import android.app.ActivityTaskManager;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TextView;
import android.widget.LinearLayout;
import android.view.View;
import android.view.LayoutInflater;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.android.internal.R;

import java.io.IOException;
@@ -49,12 +42,14 @@ public class GrantCredentialsPermissionActivity extends Activity implements View
    private Account mAccount;
    private String mAuthTokenType;
    private int mUid;
    private int mCallingUid;
    private Bundle mResultBundle = null;
    protected LayoutInflater mInflater;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().addSystemFlags(
                android.view.WindowManager.LayoutParams
                        .SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
        setContentView(R.layout.grant_credentials_permission);
        setTitle(R.string.grant_permissions_header_text);

@@ -82,20 +77,6 @@ public class GrantCredentialsPermissionActivity extends Activity implements View
            return;
        }

        try {
            IBinder activityToken = getActivityToken();
            mCallingUid = ActivityTaskManager.getService().getLaunchedFromUid(activityToken);
        } catch (RemoteException re) {
            // Couldn't figure out caller details
            Log.w(getClass().getSimpleName(), "Unable to get caller identity \n" + re);
        }

        if (!UserHandle.isSameApp(mCallingUid, Process.SYSTEM_UID) && mCallingUid != mUid) {
            setResult(Activity.RESULT_CANCELED);
            finish();
            return;
        }

        String accountTypeLabel;
        try {
            accountTypeLabel = getAccountLabel(mAccount);
+37 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.compat.Compatibility;
import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledAfter;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -52,6 +53,7 @@ import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.UserManager;
import android.provider.Settings;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.LongSparseArray;
@@ -7619,8 +7621,9 @@ public class AppOpsManager {
                    collectNotedOpForSelf(op, proxiedAttributionTag);
                } else if (collectionMode == COLLECT_SYNC
                        // Only collect app-ops when the proxy is trusted
                        && mContext.checkPermission(Manifest.permission.UPDATE_APP_OPS_STATS, -1,
                        myUid) == PackageManager.PERMISSION_GRANTED) {
                        && (mContext.checkPermission(Manifest.permission.UPDATE_APP_OPS_STATS, -1,
                        myUid) == PackageManager.PERMISSION_GRANTED
                        || isTrustedVoiceServiceProxy(mContext, mContext.getOpPackageName(), op))) {
                    collectNotedOpSync(op, proxiedAttributionTag);
                }
            }
@@ -7631,6 +7634,38 @@ public class AppOpsManager {
        }
    }

    /**
     * Checks if the voice recognition service is a trust proxy.
     *
     * @return {@code true} if the package is a trust voice recognition service proxy
     * @hide
     */
    public static boolean isTrustedVoiceServiceProxy(Context context, String packageName,
            int code) {
        // This is a workaround for R QPR, new API change is not allowed. We only allow the current
        // voice recognizer is also the voice interactor to noteproxy op.
        if (code != OP_RECORD_AUDIO) {
            return false;
        }
        final String voiceRecognitionComponent = Settings.Secure.getString(
                context.getContentResolver(), Settings.Secure.VOICE_RECOGNITION_SERVICE);
        final String voiceInteractionComponent = Settings.Secure.getString(
                context.getContentResolver(), Settings.Secure.VOICE_INTERACTION_SERVICE);

        final String voiceRecognitionServicePackageName =
                getComponentPackagenameFromString(voiceRecognitionComponent);
        final String voiceInteractionServicePackageName =
                getComponentPackagenameFromString(voiceInteractionComponent);

        return Objects.equals(packageName, voiceRecognitionServicePackageName) && Objects.equals(
                voiceRecognitionServicePackageName, voiceInteractionServicePackageName);
    }

    private static String getComponentPackagenameFromString(String from) {
        ComponentName componentName = from != null ? ComponentName.unflattenFromString(from) : null;
        return componentName != null ? componentName.getPackageName() : "";
    }

    /**
     * Do a quick check for whether an application might be able to perform an operation.
     * This is <em>not</em> a security check; you must use {@link #noteOp(String, int, String,
+2 −0
Original line number Diff line number Diff line
@@ -221,6 +221,8 @@ public class TouchExplorer extends BaseEventStreamTransformation
        mSendTouchInteractionEndDelayed.cancel();
        // Clear the gesture detector
        mGestureDetector.clear();
        // Clear the offset data by long pressing.
        mDispatcher.clear();
        // Go to initial state.
        mState.clear();
        mAms.onTouchInteractionEnd();
+5 −1
Original line number Diff line number Diff line
@@ -2989,9 +2989,13 @@ public class AppOpsService extends IAppOpsService.Stub {
            return AppOpsManager.MODE_IGNORED;
        }

        // This is a workaround for R QPR, new API change is not allowed. We only allow the current
        // voice recognizer is also the voice interactor to noteproxy op.
        final boolean isTrustVoiceServiceProxy =
                AppOpsManager.isTrustedVoiceServiceProxy(mContext, proxyPackageName, code);
        final boolean isProxyTrusted = mContext.checkPermission(
                Manifest.permission.UPDATE_APP_OPS_STATS, -1, proxyUid)
                == PackageManager.PERMISSION_GRANTED;
                == PackageManager.PERMISSION_GRANTED || isTrustVoiceServiceProxy;

        final int proxyFlags = isProxyTrusted ? AppOpsManager.OP_FLAG_TRUSTED_PROXY
                : AppOpsManager.OP_FLAG_UNTRUSTED_PROXY;
Loading