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

Commit 63709b37 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5608765 from a80dd06e to qt-release

Change-Id: Ib29d03146de5a8e92dbc13340e984b0ec3f7f30a
parents 2496e18c a80dd06e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -43,6 +43,12 @@ public abstract class DevicePolicyCache {
     */
    public abstract boolean getScreenCaptureDisabled(@UserIdInt int userHandle);

    /**
     * Caches {@link DevicePolicyManager#getPasswordQuality(android.content.ComponentName)} of the
     * given user with {@code null} passed in as argument.
     */
    public abstract int getPasswordQuality(@UserIdInt int userHandle);

    /**
     * Empty implementation.
     */
@@ -53,5 +59,10 @@ public abstract class DevicePolicyCache {
        public boolean getScreenCaptureDisabled(int userHandle) {
            return false;
        }

        @Override
        public int getPasswordQuality(int userHandle) {
            return DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
        }
    }
}
+26 −3
Original line number Diff line number Diff line
@@ -156,6 +156,8 @@ public class BlockedNumberContract {
    /** A content:// style uri to the authority for the blocked number provider */
    public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);

    private static final String LOG_TAG = BlockedNumberContract.class.getSimpleName();

    /**
     * Constants to interact with the blocked numbers list.
     */
@@ -326,7 +328,10 @@ public class BlockedNumberContract {
        try {
            final Bundle res = context.getContentResolver().call(
                    AUTHORITY_URI, METHOD_IS_BLOCKED, phoneNumber, null);
            return res != null && res.getBoolean(RES_NUMBER_IS_BLOCKED, false);
            boolean isBlocked = res != null && res.getBoolean(RES_NUMBER_IS_BLOCKED, false);
            Log.d(LOG_TAG, "isBlocked: phoneNumber=%s, isBlocked=%b", Log.piiHandle(phoneNumber),
                    isBlocked);
            return isBlocked;
        } catch (NullPointerException | IllegalArgumentException ex) {
            // The content resolver can throw an NPE or IAE; we don't want to crash Telecom if
            // either of these happen.
@@ -354,6 +359,7 @@ public class BlockedNumberContract {
     */
    @WorkerThread
    public static int unblock(Context context, String phoneNumber) {
        Log.d(LOG_TAG, "unblock: phoneNumber=%s", Log.piiHandle(phoneNumber));
        final Bundle res = context.getContentResolver().call(
                AUTHORITY_URI, METHOD_UNBLOCK, phoneNumber, null);
        return res.getInt(RES_NUM_ROWS_DELETED, 0);
@@ -445,6 +451,7 @@ public class BlockedNumberContract {
         */
        public static void notifyEmergencyContact(Context context) {
            try {
                Log.i(LOG_TAG, "notifyEmergencyContact; caller=%s", context.getOpPackageName());
                context.getContentResolver().call(
                        AUTHORITY_URI, METHOD_NOTIFY_EMERGENCY_CONTACT, null, null);
            } catch (NullPointerException | IllegalArgumentException ex) {
@@ -459,6 +466,8 @@ public class BlockedNumberContract {
         * contacted recently at all, calling this method is a no-op.
         */
        public static void endBlockSuppression(Context context) {
            String caller = context.getOpPackageName();
            Log.i(LOG_TAG, "endBlockSuppression: caller=%s", caller);
            context.getContentResolver().call(
                    AUTHORITY_URI, METHOD_END_BLOCK_SUPPRESSION, null, null);
        }
@@ -480,10 +489,14 @@ public class BlockedNumberContract {
        public static int shouldSystemBlockNumber(Context context, String phoneNumber,
                Bundle extras) {
            try {
                String caller = context.getOpPackageName();
                final Bundle res = context.getContentResolver().call(
                        AUTHORITY_URI, METHOD_SHOULD_SYSTEM_BLOCK_NUMBER, phoneNumber, extras);
                return res != null ? res.getInt(RES_BLOCK_STATUS, STATUS_NOT_BLOCKED) :
                int blockResult = res != null ? res.getInt(RES_BLOCK_STATUS, STATUS_NOT_BLOCKED) :
                        BlockedNumberContract.STATUS_NOT_BLOCKED;
                Log.d(LOG_TAG, "shouldSystemBlockNumber: number=%s, caller=%s, result=%s",
                        Log.piiHandle(phoneNumber), caller, blockStatusToString(blockResult));
                return blockResult;
            } catch (NullPointerException | IllegalArgumentException ex) {
                // The content resolver can throw an NPE or IAE; we don't want to crash Telecom if
                // either of these happen.
@@ -498,8 +511,12 @@ public class BlockedNumberContract {
        public static BlockSuppressionStatus getBlockSuppressionStatus(Context context) {
            final Bundle res = context.getContentResolver().call(
                    AUTHORITY_URI, METHOD_GET_BLOCK_SUPPRESSION_STATUS, null, null);
            return new BlockSuppressionStatus(res.getBoolean(RES_IS_BLOCKING_SUPPRESSED, false),
            BlockSuppressionStatus blockSuppressionStatus = new BlockSuppressionStatus(
                    res.getBoolean(RES_IS_BLOCKING_SUPPRESSED, false),
                    res.getLong(RES_BLOCKING_SUPPRESSED_UNTIL_TIMESTAMP, 0));
            Log.d(LOG_TAG, "getBlockSuppressionStatus: caller=%s, status=%s",
                    context.getOpPackageName(), blockSuppressionStatus);
            return blockSuppressionStatus;
        }

        /**
@@ -607,6 +624,12 @@ public class BlockedNumberContract {
                this.isSuppressed = isSuppressed;
                this.untilTimestampMillis = untilTimestampMillis;
            }

            @Override
            public String toString() {
                return "[BlockSuppressionStatus; isSuppressed=" + isSuppressed + ", until="
                        + untilTimestampMillis + "]";
            }
        }
    }
}
+17 −30
Original line number Diff line number Diff line
@@ -172,11 +172,6 @@ public final class Zygote {
     */
    public static final int SOCKET_BUFFER_SIZE = 256;

    /**
     * @hide for internal use only
     */
    private static final int PRIORITY_MAX = -20;

    /** a prototype instance for a future List.toArray() */
    protected static final int[][] INT_ARRAY_2D = new int[0][0];

@@ -241,7 +236,8 @@ public final class Zygote {
            int[] fdsToIgnore, boolean startChildZygote, String instructionSet, String appDataDir,
            int targetSdkVersion) {
        ZygoteHooks.preFork();

        // Resets nice priority for zygote process.
        resetNicePriority();
        int pid = nativeForkAndSpecialize(
                uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo, niceName, fdsToClose,
                fdsToIgnore, startChildZygote, instructionSet, appDataDir);
@@ -253,7 +249,6 @@ public final class Zygote {
            // Note that this event ends at the end of handleChildProc,
            Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "PostFork");
        }

        ZygoteHooks.postForkCommon();
        return pid;
    }
@@ -340,16 +335,15 @@ public final class Zygote {
    public static int forkSystemServer(int uid, int gid, int[] gids, int runtimeFlags,
            int[][] rlimits, long permittedCapabilities, long effectiveCapabilities) {
        ZygoteHooks.preFork();

        // Resets nice priority for zygote process.
        resetNicePriority();
        int pid = nativeForkSystemServer(
                uid, gid, gids, runtimeFlags, rlimits,
                permittedCapabilities, effectiveCapabilities);

        // Enable tracing as soon as we enter the system_server.
        if (pid == 0) {
            Trace.setTracingEnabled(true, runtimeFlags);
        }

        ZygoteHooks.postForkCommon();
        return pid;
    }
@@ -467,16 +461,13 @@ public final class Zygote {
    /**
     * Fork a new unspecialized app process from the zygote
     *
     * @param usapPoolSocket  The server socket the USAP will call accept on
     * @param sessionSocketRawFDs  Anonymous session sockets that are currently open
     * @param isPriorityFork  Value controlling the process priority level until accept is called
     * @return In the Zygote process this function will always return null; in unspecialized app
     *         processes this function will return a Runnable object representing the new
     *         application that is passed up from usapMain.
     */
    static Runnable forkUsap(LocalServerSocket usapPoolSocket,
                             int[] sessionSocketRawFDs,
                             boolean isPriorityFork) {
                             int[] sessionSocketRawFDs) {
        FileDescriptor[] pipeFDs = null;

        try {
@@ -486,8 +477,7 @@ public final class Zygote {
        }

        int pid =
                nativeForkUsap(pipeFDs[0].getInt$(), pipeFDs[1].getInt$(),
                               sessionSocketRawFDs, isPriorityFork);
                nativeForkUsap(pipeFDs[0].getInt$(), pipeFDs[1].getInt$(), sessionSocketRawFDs);

        if (pid == 0) {
            IoUtils.closeQuietly(pipeFDs[0]);
@@ -502,8 +492,7 @@ public final class Zygote {

    private static native int nativeForkUsap(int readPipeFD,
                                                 int writePipeFD,
                                             int[] sessionSocketRawFDs,
                                             boolean isPriorityFork);
                                                 int[] sessionSocketRawFDs);

    /**
     * This function is used by unspecialized app processes to wait for specialization requests from
@@ -526,11 +515,6 @@ public final class Zygote {
        // Load resources
        ZygoteInit.nativePreloadGraphicsDriver();

        // Change the priority to max before calling accept so we can respond to new specialization
        // requests as quickly as possible.  This will be reverted to the default priority in the
        // native specialization code.
        boostUsapPriority();

        while (true) {
            try {
                sessionSocket = usapPoolSocket.accept();
@@ -634,12 +618,6 @@ public final class Zygote {
                                     null /* classLoader */);
    }

    private static void boostUsapPriority() {
        nativeBoostUsapPriority();
    }

    private static native void nativeBoostUsapPriority();

    private static final String USAP_ERROR_PREFIX = "Invalid command to USAP: ";

    /**
@@ -879,6 +857,15 @@ public final class Zygote {
        ZygoteHooks.postForkChild(runtimeFlags, isSystemServer, isZygote, instructionSet);
    }

    /**
     * Resets the calling thread priority to the default value (Thread.NORM_PRIORITY
     * or nice value 0). This updates both the priority value in java.lang.Thread and
     * the nice value (setpriority).
     */
    static void resetNicePriority() {
        Thread.currentThread().setPriority(Thread.NORM_PRIORITY);
    }

    /**
     * Executes "/system/bin/sh -c <command>" using the exec() system call.
     * This method throws a runtime exception if exec() failed, otherwise, this
+1 −1
Original line number Diff line number Diff line
@@ -346,7 +346,7 @@ class ZygoteConnection {
            if (zygoteServer.isUsapPoolEnabled()) {
                Runnable fpResult =
                        zygoteServer.fillUsapPool(
                                new int[]{mSocket.getFileDescriptor().getInt$()}, false);
                                new int[]{mSocket.getFileDescriptor().getInt$()});

                if (fpResult != null) {
                    zygoteServer.setForkChild();
+2 −3
Original line number Diff line number Diff line
@@ -822,9 +822,6 @@ public class ZygoteInit {
    public static void main(String argv[]) {
        ZygoteServer zygoteServer = null;

        // Set the initial thread priority to the "normal" value.
        Thread.currentThread().setPriority(Thread.NORM_PRIORITY);

        // Mark zygote start. This ensures that thread creation will throw
        // an error.
        ZygoteHooks.startZygoteNoThreadCreation();
@@ -884,6 +881,8 @@ public class ZygoteInit {
                EventLog.writeEvent(LOG_BOOT_PROGRESS_PRELOAD_END,
                        SystemClock.uptimeMillis());
                bootTimingsTraceLog.traceEnd(); // ZygotePreload
            } else {
                Zygote.resetNicePriority();
            }

            // Do an initial gc to clean up after startup
Loading