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

Commit 54255d48 authored by Hongming Jin's avatar Hongming Jin
Browse files

Rename GlobalActionPerformer to SystemActionPerformer.

Bug: 136286274
Test: atest SystemActionPerformerTest
Change-Id: I6eb18300fa3173a96cef57fee3a68eba3145b9cd
parent d083cf5e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
    protected final Context mContext;
    protected final SystemSupport mSystemSupport;
    protected final WindowManagerInternal mWindowManagerService;
    private final GlobalActionPerformer mGlobalActionPerformer;
    private final SystemActionPerformer mSystemActionPerformer;
    private final AccessibilityWindowManager mA11yWindowManager;
    private final DisplayManager mDisplayManager;
    private final PowerManager mPowerManager;
@@ -213,7 +213,7 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
            AccessibilityServiceInfo accessibilityServiceInfo, int id, Handler mainHandler,
            Object lock, AccessibilitySecurityPolicy securityPolicy, SystemSupport systemSupport,
            WindowManagerInternal windowManagerInternal,
            GlobalActionPerformer globalActionPerfomer,
            SystemActionPerformer systemActionPerfomer,
            AccessibilityWindowManager a11yWindowManager) {
        mContext = context;
        mWindowManagerService = windowManagerInternal;
@@ -222,7 +222,7 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
        mAccessibilityServiceInfo = accessibilityServiceInfo;
        mLock = lock;
        mSecurityPolicy = securityPolicy;
        mGlobalActionPerformer = globalActionPerfomer;
        mSystemActionPerformer = systemActionPerfomer;
        mSystemSupport = systemSupport;
        mInvocationHandler = new InvocationHandler(mainHandler.getLooper());
        mA11yWindowManager = a11yWindowManager;
@@ -760,7 +760,7 @@ abstract class AbstractAccessibilityServiceConnection extends IAccessibilityServ
                return false;
            }
        }
        return mGlobalActionPerformer.performGlobalAction(action);
        return mSystemActionPerformer.performSystemAction(action);
    }

    @Override
+5 −5
Original line number Diff line number Diff line
@@ -198,7 +198,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub

    private final MainHandler mMainHandler;

    private final GlobalActionPerformer mGlobalActionPerformer;
    private final SystemActionPerformer mSystemActionPerformer;

    private MagnificationController mMagnificationController;

@@ -272,7 +272,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
        mWindowManagerService = LocalServices.getService(WindowManagerInternal.class);
        mSecurityPolicy = new AccessibilitySecurityPolicy(mContext, this);
        mMainHandler = new MainHandler(mContext.getMainLooper());
        mGlobalActionPerformer = new GlobalActionPerformer(mContext, mWindowManagerService);
        mSystemActionPerformer = new SystemActionPerformer(mContext, mWindowManagerService);
        mA11yWindowManager = new AccessibilityWindowManager(mLock, mMainHandler,
                mWindowManagerService, this, mSecurityPolicy, this);
        mA11yDisplayListener = new AccessibilityDisplayListener(mContext, mMainHandler);
@@ -730,7 +730,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
        synchronized (mLock) {
            mUiAutomationManager.registerUiTestAutomationServiceLocked(owner, serviceClient,
                    mContext, accessibilityServiceInfo, sIdCounter++, mMainHandler,
                    mSecurityPolicy, this, mWindowManagerService, mGlobalActionPerformer,
                    mSecurityPolicy, this, mWindowManagerService, mSystemActionPerformer,
                    mA11yWindowManager, flags);
            onUserStateChangedLocked(getCurrentUserStateLocked());
        }
@@ -1450,7 +1450,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                if (service == null) {
                    service = new AccessibilityServiceConnection(userState, mContext, componentName,
                            installedService, sIdCounter++, mMainHandler, mLock, mSecurityPolicy,
                            this, mWindowManagerService, mGlobalActionPerformer,
                            this, mWindowManagerService, mSystemActionPerformer,
                            mA11yWindowManager);
                } else if (userState.mBoundServices.contains(service)) {
                    continue;
@@ -2482,7 +2482,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                    userState, mContext,
                    COMPONENT_NAME, info, sIdCounter++, mMainHandler, mLock, mSecurityPolicy,
                    AccessibilityManagerService.this, mWindowManagerService,
                    mGlobalActionPerformer, mA11yWindowManager) {
                    mSystemActionPerformer, mA11yWindowManager) {
                @Override
                public boolean supportsFlagForNotImportantViews(AccessibilityServiceInfo info) {
                    return true;
+2 −2
Original line number Diff line number Diff line
@@ -71,9 +71,9 @@ class AccessibilityServiceConnection extends AbstractAccessibilityServiceConnect
            AccessibilityServiceInfo accessibilityServiceInfo, int id, Handler mainHandler,
            Object lock, AccessibilitySecurityPolicy securityPolicy, SystemSupport systemSupport,
            WindowManagerInternal windowManagerInternal,
            GlobalActionPerformer globalActionPerfomer, AccessibilityWindowManager awm) {
            SystemActionPerformer systemActionPerfomer, AccessibilityWindowManager awm) {
        super(context, componentName, accessibilityServiceInfo, id, mainHandler, lock,
                securityPolicy, systemSupport, windowManagerInternal, globalActionPerfomer, awm);
                securityPolicy, systemSupport, windowManagerInternal, systemActionPerfomer, awm);
        mUserStateWeakReference = new WeakReference<UserState>(userState);
        mIntent = new Intent().setComponent(mComponentName);
        mMainHandler = mainHandler;
+20 −17
Original line number Diff line number Diff line
/*
 ** Copyright 2017, The Android Open Source Project
 **
 ** Licensed under the Apache License, Version 2.0 (the "License");
 ** you may not use this file except in compliance with the License.
 ** You may obtain a copy of the License at
 **
 **     http://www.apache.org/licenses/LICENSE-2.0
 **
 ** Unless required by applicable law or agreed to in writing, software
 ** distributed under the License is distributed on an "AS IS" BASIS,
 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ** See the License for the specific language governing permissions and
 ** limitations under the License.
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.server.accessibility;
@@ -40,12 +40,12 @@ import java.util.function.Supplier;
/**
 * Handle the back-end of AccessibilityService#performGlobalAction
 */
public class GlobalActionPerformer {
public class SystemActionPerformer {
    private final WindowManagerInternal mWindowManagerService;
    private final Context mContext;
    private Supplier<ScreenshotHelper> mScreenshotHelperSupplier;

    public GlobalActionPerformer(Context context, WindowManagerInternal windowManagerInternal) {
    public SystemActionPerformer(Context context, WindowManagerInternal windowManagerInternal) {
        mContext = context;
        mWindowManagerService = windowManagerInternal;
        mScreenshotHelperSupplier = null;
@@ -53,13 +53,16 @@ public class GlobalActionPerformer {

    // Used to mock ScreenshotHelper
    @VisibleForTesting
    public GlobalActionPerformer(Context context, WindowManagerInternal windowManagerInternal,
    public SystemActionPerformer(Context context, WindowManagerInternal windowManagerInternal,
            Supplier<ScreenshotHelper> screenshotHelperSupplier) {
        this(context, windowManagerInternal);
        mScreenshotHelperSupplier = screenshotHelperSupplier;
    }

    public boolean performGlobalAction(int action) {
    /**
     * Performe the system action matching the given action id.
     */
    public boolean performSystemAction(int action) {
        final long identity = Binder.clearCallingIdentity();
        try {
            switch (action) {
+4 −4
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ class UiAutomationManager {
            AccessibilitySecurityPolicy securityPolicy,
            AbstractAccessibilityServiceConnection.SystemSupport systemSupport,
            WindowManagerInternal windowManagerInternal,
            GlobalActionPerformer globalActionPerfomer,
            SystemActionPerformer systemActionPerfomer,
            AccessibilityWindowManager awm, int flags) {
        synchronized (mLock) {
            accessibilityServiceInfo.setComponentName(COMPONENT_NAME);
@@ -108,7 +108,7 @@ class UiAutomationManager {
            mSystemSupport = systemSupport;
            mUiAutomationService = new UiAutomationService(context, accessibilityServiceInfo, id,
                    mainHandler, mLock, securityPolicy, systemSupport, windowManagerInternal,
                    globalActionPerfomer, awm);
                    systemActionPerfomer, awm);
            mUiAutomationServiceOwner = owner;
            mUiAutomationFlags = flags;
            mUiAutomationServiceInfo = accessibilityServiceInfo;
@@ -226,9 +226,9 @@ class UiAutomationManager {
                int id, Handler mainHandler, Object lock,
                AccessibilitySecurityPolicy securityPolicy,
                SystemSupport systemSupport, WindowManagerInternal windowManagerInternal,
                GlobalActionPerformer globalActionPerfomer, AccessibilityWindowManager awm) {
                SystemActionPerformer systemActionPerfomer, AccessibilityWindowManager awm) {
            super(context, COMPONENT_NAME, accessibilityServiceInfo, id, mainHandler, lock,
                    securityPolicy, systemSupport, windowManagerInternal, globalActionPerfomer,
                    securityPolicy, systemSupport, windowManagerInternal, systemActionPerfomer,
                    awm);
            mMainHandler = mainHandler;
        }
Loading