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

Commit 4f542d02 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8274893 from 34c8baf0 to sc-qpr3-release

Change-Id: I06f1ea90d325e052c1ee4d18c68b8e719cf97b7f
parents 865e888c 34c8baf0
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -45,4 +45,7 @@ interface INfcTag
    boolean canMakeReadOnly(int ndefType);
    int getMaxTransceiveLength(int technology);
    boolean getExtendedLengthApdusSupported();

    void setTagUpToDate(long cookie);
    boolean isTagUpToDate(long cookie);
}
+29 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.SystemClock;

import java.io.IOException;
import java.util.Arrays;
@@ -121,6 +122,7 @@ public final class Tag implements Parcelable {
    final INfcTag mTagService; // interface to NFC service, will be null if mock tag

    int mConnectedTechnology;
    long mCookie;

    /**
     * Hidden constructor to be used by NFC service and internal classes.
@@ -140,6 +142,17 @@ public final class Tag implements Parcelable {
        mTagService = tagService;

        mConnectedTechnology = -1;
        mCookie = SystemClock.elapsedRealtime();

        if (tagService == null) {
            return;
        }

        try {
            tagService.setTagUpToDate(mCookie);
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

    /**
@@ -361,6 +374,22 @@ public final class Tag implements Parcelable {
    /** @hide */
    @UnsupportedAppUsage
    public INfcTag getTagService() {
        if (mTagService == null) {
            return null;
        }

        try {
            if (!mTagService.isTagUpToDate(mCookie)) {
                String id_str = "";
                for (int i = 0; i < mId.length; i++) {
                    id_str = id_str + String.format("%02X ", mId[i]);
                }
                String msg = "Permission Denial: Tag ( ID: " + id_str + ") is out of date";
                throw new SecurityException(msg);
            }
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
        return mTagService;
    }

+17 −5
Original line number Diff line number Diff line
@@ -13804,14 +13804,26 @@ public class ActivityManagerService extends IActivityManager.Stub
                return false;
            }
            if (!Build.IS_DEBUGGABLE) {
            int match = mContext.getPackageManager().checkSignatures(
                    ii.targetPackage, ii.packageName);
            if (match < 0 && match != PackageManager.SIGNATURE_FIRST_NOT_SIGNED) {
                if (Build.IS_DEBUGGABLE) {
                    String message = "Instrumentation test " + ii.packageName
                            + " doesn't have a signature matching the target "
                            + ii.targetPackage
                            + ", which would not be allowed on the production Android builds";
                    if (callingUid != Process.ROOT_UID) {
                        Slog.e(TAG, message
                                + ". THIS WILL BE DISALLOWED ON FUTURE ANDROID VERSIONS"
                                + " unless from a rooted ADB shell.");
                    } else {
                        Slog.w(TAG, message);
                    }
                } else {
                    String msg = "Permission Denial: starting instrumentation "
                            + className + " from pid="
                            + Binder.getCallingPid()
                            + ", uid=" + Binder.getCallingPid()
                            + ", uid=" + Binder.getCallingUid()
                            + " not allowed because package " + ii.packageName
                            + " does not have a signature matching the target "
                            + ii.targetPackage;