Merge "(4/n) Remove whole One-handed mode overlay mechanism and fix quick setting tiles flashes problem when toggle on/off on one-handed mode tile"
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.wm.shell.onehanded;
|
||||
|
||||
import static android.os.UserHandle.USER_CURRENT;
|
||||
import static android.os.UserHandle.myUserId;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
@@ -30,12 +29,10 @@ import android.annotation.BinderThread;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.om.IOverlayManager;
|
||||
import android.content.om.OverlayInfo;
|
||||
import android.content.res.Configuration;
|
||||
import android.database.ContentObserver;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Handler;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.SystemProperties;
|
||||
import android.provider.Settings;
|
||||
@@ -70,9 +67,6 @@ public class OneHandedController implements RemoteCallable<OneHandedController>,
|
||||
|
||||
private static final String ONE_HANDED_MODE_OFFSET_PERCENTAGE =
|
||||
"persist.debug.one_handed_offset_percentage";
|
||||
private static final String ONE_HANDED_MODE_GESTURAL_OVERLAY =
|
||||
"com.android.internal.systemui.onehanded.gestural";
|
||||
private static final int OVERLAY_ENABLED_DELAY_MS = 250;
|
||||
private static final int DISPLAY_AREA_READY_RETRY_MS = 10;
|
||||
|
||||
public static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode";
|
||||
@@ -282,7 +276,6 @@ public class OneHandedController implements RemoteCallable<OneHandedController>,
|
||||
setupCallback();
|
||||
registerSettingObservers(mUserId);
|
||||
setupTimeoutListener();
|
||||
setupGesturalOverlay();
|
||||
updateSettings();
|
||||
|
||||
mAccessibilityManager = AccessibilityManager.getInstance(context);
|
||||
@@ -517,11 +510,6 @@ public class OneHandedController implements RemoteCallable<OneHandedController>,
|
||||
: OneHandedUiEventLogger.EVENT_ONE_HANDED_SETTINGS_ENABLED_OFF);
|
||||
|
||||
setOneHandedEnabled(enabled);
|
||||
|
||||
// Also checks swipe to notification settings since they all need gesture overlay.
|
||||
setEnabledGesturalOverlay(
|
||||
enabled || mOneHandedSettingsUtil.getSettingsSwipeToNotificationEnabled(
|
||||
mContext.getContentResolver(), mUserId), true /* DelayExecute */);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -602,40 +590,6 @@ public class OneHandedController implements RemoteCallable<OneHandedController>,
|
||||
}
|
||||
}
|
||||
|
||||
private void setupGesturalOverlay() {
|
||||
if (!mOneHandedSettingsUtil.getSettingsOneHandedModeEnabled(
|
||||
mContext.getContentResolver(), mUserId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
OverlayInfo info = null;
|
||||
try {
|
||||
mOverlayManager.setHighestPriority(ONE_HANDED_MODE_GESTURAL_OVERLAY, USER_CURRENT);
|
||||
info = mOverlayManager.getOverlayInfo(ONE_HANDED_MODE_GESTURAL_OVERLAY, USER_CURRENT);
|
||||
} catch (RemoteException e) { /* Do nothing */ }
|
||||
|
||||
if (info != null && !info.isEnabled()) {
|
||||
// Enable the default gestural one handed overlay.
|
||||
setEnabledGesturalOverlay(true /* enabled */, false /* delayExecute */);
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
private void setEnabledGesturalOverlay(boolean enabled, boolean delayExecute) {
|
||||
if (mState.isTransitioning() || delayExecute) {
|
||||
// Enabled overlay package may affect the current animation(e.g:Settings switch),
|
||||
// so we delay 250ms to enabled overlay after switch animation finish, only delay once.
|
||||
mMainExecutor.executeDelayed(() -> setEnabledGesturalOverlay(enabled, false),
|
||||
OVERLAY_ENABLED_DELAY_MS);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
mOverlayManager.setEnabled(ONE_HANDED_MODE_GESTURAL_OVERLAY, enabled, USER_CURRENT);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void setLockedDisabled(boolean locked, boolean enabled) {
|
||||
final boolean isFeatureEnabled = mIsOneHandedEnabled || mIsSwipeToNotificationEnabled;
|
||||
@@ -714,19 +668,6 @@ public class OneHandedController implements RemoteCallable<OneHandedController>,
|
||||
}
|
||||
|
||||
mOneHandedSettingsUtil.dump(pw, innerPrefix, mContext.getContentResolver(), mUserId);
|
||||
|
||||
if (mOverlayManager != null) {
|
||||
OverlayInfo info = null;
|
||||
try {
|
||||
info = mOverlayManager.getOverlayInfo(ONE_HANDED_MODE_GESTURAL_OVERLAY,
|
||||
USER_CURRENT);
|
||||
} catch (RemoteException e) { /* Do nothing */ }
|
||||
|
||||
if (info != null && !info.isEnabled()) {
|
||||
pw.print(innerPrefix + "OverlayInfo=");
|
||||
pw.println(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,6 @@ LOCAL_REQUIRED_MODULES := \
|
||||
NavigationBarModeGesturalOverlayNarrowBack \
|
||||
NavigationBarModeGesturalOverlayWideBack \
|
||||
NavigationBarModeGesturalOverlayExtraWideBack \
|
||||
OneHandedModeGesturalOverlay \
|
||||
preinstalled-packages-platform-overlays.xml
|
||||
|
||||
include $(BUILD_PHONY_PACKAGE)
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
//
|
||||
// Copyright 2020, 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 {
|
||||
// See: http://go/android-license-faq
|
||||
// A large-scale-change added 'default_applicable_licenses' to import
|
||||
// all of the 'license_kinds' from "frameworks_base_license"
|
||||
// to get the below license kinds:
|
||||
// SPDX-license-identifier-Apache-2.0
|
||||
default_applicable_licenses: ["frameworks_base_license"],
|
||||
}
|
||||
|
||||
runtime_resource_overlay {
|
||||
name: "OneHandedModeGesturalOverlay",
|
||||
theme: "OneHandedModeGestural",
|
||||
product_specific: true,
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<!--
|
||||
/**
|
||||
* Copyright (c) 2020, 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.
|
||||
*/
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.internal.systemui.onehanded.gestural"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
<overlay android:targetPackage="android"
|
||||
android:category="com.android.internal.one_handed_mode"
|
||||
android:priority="2"/>
|
||||
<!-- To override dimen in NavigationBarModeGesturalOverlay, priority should be higher -->
|
||||
|
||||
<application android:label="@string/one_handed_mode_title" android:hasCode="false"/>
|
||||
</manifest>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright (c) 2020, 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.
|
||||
*/
|
||||
-->
|
||||
<resources>
|
||||
<!-- The height of the bottom navigation gesture area. -->
|
||||
<dimen name="navigation_bar_gesture_larger_height">80dp</dimen>
|
||||
</resources>
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/**
|
||||
* Copyright (c) 2020, 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.
|
||||
*/
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- Name of overlay [CHAR LIMIT=64] -->
|
||||
<string name="one_handed_mode_title" translatable="false">One Handed Mode</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user