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

Commit 5c89f44e authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

Implement the global accessibility action to expand notifications.

bug:6468852

Change-Id: Id4494a07b1ed96773e22dcfdd5991afe3ee98004
parent 0aeb05e6
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.accessibilityservice.AccessibilityServiceInfo;
import android.accessibilityservice.IAccessibilityServiceClient;
import android.accessibilityservice.IAccessibilityServiceConnection;
import android.app.PendingIntent;
import android.app.StatusBarManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -1343,7 +1344,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                    sendDownAndUpKeyEvents(KeyEvent.KEYCODE_APP_SWITCH);
                } return true;
                case AccessibilityService.GLOBAL_ACTION_NOTIFICATIONS: {
                    // TODO: Implement when 6346026 is fixed.
                    expandStatusBar();
                } return true;
            }
            return false;
@@ -1413,6 +1414,16 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
            Binder.restoreCallingIdentity(token);
        }

        private void expandStatusBar() {
            final long token = Binder.clearCallingIdentity();

            StatusBarManager statusBarManager = (StatusBarManager) mContext.getSystemService(
                    android.app.Service.STATUS_BAR_SERVICE);
            statusBarManager.expand();

            Binder.restoreCallingIdentity(token);
        }

        private IAccessibilityInteractionConnection getConnectionLocked(int windowId) {
            if (DEBUG) {
                Slog.i(LOG_TAG, "Trying to get interaction connection to windowId: " + windowId);