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

Commit b5e89c6d authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Support direct-boot tests.

Add shell commands to check on current FBE status and system ready
status.  Mark variables without first-class locking as volatile.

Fix bug where UI automation would crash while device was locked by
marking it as forced direct-boot aware.

Bug: 26498834
Change-Id: Ib4dfb9350925e5413f93a09baacf84c62f2ba0ea
parent 6855c480
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -88,6 +88,8 @@ public final class Sm {
            runForget();
        } else if ("set-emulate-fbe".equals(op)) {
            runSetEmulateFbe();
        } else if ("get-fbe-mode".equals(op)) {
            runGetFbeMode();
        } else {
            throw new IllegalArgumentException();
        }
@@ -145,6 +147,16 @@ public final class Sm {
                StorageManager.DEBUG_EMULATE_FBE);
    }

    public void runGetFbeMode() {
        if (StorageManager.isFileEncryptedNativeOnly()) {
            System.out.println("native");
        } else if (StorageManager.isFileEncryptedEmulatedOnly()) {
            System.out.println("emulated");
        } else {
            System.out.println("none");
        }
    }

    public void runPartition() throws RemoteException {
        final String diskId = nextArg();
        final String type = nextArg();
+8 −4
Original line number Diff line number Diff line
@@ -36,11 +36,11 @@ import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;

import com.android.internal.R;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import com.android.internal.R;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
@@ -319,6 +319,9 @@ public class AccessibilityServiceInfo implements Parcelable {
     */
    public static final int FLAG_RETRIEVE_INTERACTIVE_WINDOWS = 0x00000040;

    /** {@hide} */
    public static final int FLAG_FORCE_DIRECT_BOOT_AWARE = 0x00010000;

    /**
     * The event types an {@link AccessibilityService} is interested in.
     * <p>
@@ -687,8 +690,9 @@ public class AccessibilityServiceInfo implements Parcelable {
    }

    /** {@hide} */
    public boolean isEncryptionAware() {
        return mResolveInfo.serviceInfo.directBootAware;
    public boolean isDirectBootAware() {
        return ((flags & FLAG_FORCE_DIRECT_BOOT_AWARE) != 0)
                || mResolveInfo.serviceInfo.directBootAware;
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
        }
        return sSystemReady;
    }
    static boolean sSystemReady = false;
    static volatile boolean sSystemReady = false;

    static public void broadcastStickyIntent(Intent intent, String permission, int userId) {
        broadcastStickyIntent(intent, permission, AppOpsManager.OP_NONE, userId);
+5 −2
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.view.WindowAnimationFrameStats;
import android.view.WindowContentFrameStats;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.IAccessibilityManager;

import libcore.io.IoUtils;

import java.io.FileOutputStream;
@@ -77,6 +78,7 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {

    private int mOwningUid;

    @Override
    public void connect(IAccessibilityServiceClient client, int flags) {
        if (client == null) {
            throw new IllegalArgumentException("Client cannot be null!");
@@ -326,11 +328,12 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
            int flags) {
        IAccessibilityManager manager = IAccessibilityManager.Stub.asInterface(
                ServiceManager.getService(Context.ACCESSIBILITY_SERVICE));
        AccessibilityServiceInfo info = new AccessibilityServiceInfo();
        final AccessibilityServiceInfo info = new AccessibilityServiceInfo();
        info.eventTypes = AccessibilityEvent.TYPES_ALL_MASK;
        info.feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC;
        info.flags |= AccessibilityServiceInfo.FLAG_INCLUDE_NOT_IMPORTANT_VIEWS
                | AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS;
                | AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS
                | AccessibilityServiceInfo.FLAG_FORCE_DIRECT_BOOT_AWARE;
        info.setCapabilities(AccessibilityServiceInfo.CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT
                | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION
                | AccessibilityServiceInfo.CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY
+1 −1
Original line number Diff line number Diff line
@@ -1262,7 +1262,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
            Service service = componentNameToServiceMap.get(componentName);

            // Ignore non-encryption-aware services until user is unlocked
            if (!isUnlocked && !installedService.isEncryptionAware()) {
            if (!isUnlocked && !installedService.isDirectBootAware()) {
                Slog.d(LOG_TAG, "Ignoring non-encryption-aware service " + componentName);
                continue;
            }
Loading