Merge "Ensure that autohide accounts for accessibilty timeout override" into tm-qpr-dev
This commit is contained in:
@@ -1016,6 +1016,9 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
|
|||||||
pw.println(" mOrientedHandleSamplingRegion: " + mOrientedHandleSamplingRegion);
|
pw.println(" mOrientedHandleSamplingRegion: " + mOrientedHandleSamplingRegion);
|
||||||
mView.dump(pw);
|
mView.dump(pw);
|
||||||
mRegionSamplingHelper.dump(pw);
|
mRegionSamplingHelper.dump(pw);
|
||||||
|
if (mAutoHideController != null) {
|
||||||
|
mAutoHideController.dump(pw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----- CommandQueue Callbacks -----
|
// ----- CommandQueue Callbacks -----
|
||||||
|
|||||||
@@ -16,25 +16,35 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar.phone;
|
package com.android.systemui.statusbar.phone;
|
||||||
|
|
||||||
|
import static android.view.accessibility.AccessibilityManager.FLAG_CONTENT_CONTROLS;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
import android.view.accessibility.AccessibilityManager;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.android.systemui.dagger.SysUISingleton;
|
import com.android.systemui.dagger.SysUISingleton;
|
||||||
import com.android.systemui.dagger.qualifiers.Main;
|
import com.android.systemui.dagger.qualifiers.Main;
|
||||||
|
import com.android.systemui.dump.DumpManager;
|
||||||
import com.android.systemui.statusbar.AutoHideUiElement;
|
import com.android.systemui.statusbar.AutoHideUiElement;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
/** A controller to control all auto-hide things. Also see {@link AutoHideUiElement}. */
|
/** A controller to control all auto-hide things. Also see {@link AutoHideUiElement}. */
|
||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
public class AutoHideController {
|
public class AutoHideController {
|
||||||
private static final String TAG = "AutoHideController";
|
private static final String TAG = "AutoHideController";
|
||||||
private static final long AUTO_HIDE_TIMEOUT_MS = 2250;
|
private static final int AUTO_HIDE_TIMEOUT_MS = 2250;
|
||||||
|
private static final int USER_AUTO_HIDE_TIMEOUT_MS = 350;
|
||||||
|
|
||||||
|
private final AccessibilityManager mAccessibilityManager;
|
||||||
private final IWindowManager mWindowManagerService;
|
private final IWindowManager mWindowManagerService;
|
||||||
private final Handler mHandler;
|
private final Handler mHandler;
|
||||||
|
|
||||||
@@ -52,11 +62,12 @@ public class AutoHideController {
|
|||||||
};
|
};
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AutoHideController(Context context, @Main Handler handler,
|
public AutoHideController(Context context,
|
||||||
|
@Main Handler handler,
|
||||||
IWindowManager iWindowManager) {
|
IWindowManager iWindowManager) {
|
||||||
|
mAccessibilityManager = context.getSystemService(AccessibilityManager.class);
|
||||||
mHandler = handler;
|
mHandler = handler;
|
||||||
mWindowManagerService = iWindowManager;
|
mWindowManagerService = iWindowManager;
|
||||||
|
|
||||||
mDisplayId = context.getDisplayId();
|
mDisplayId = context.getDisplayId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +149,12 @@ public class AutoHideController {
|
|||||||
|
|
||||||
private void scheduleAutoHide() {
|
private void scheduleAutoHide() {
|
||||||
cancelAutoHide();
|
cancelAutoHide();
|
||||||
mHandler.postDelayed(mAutoHide, AUTO_HIDE_TIMEOUT_MS);
|
mHandler.postDelayed(mAutoHide, getAutoHideTimeout());
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getAutoHideTimeout() {
|
||||||
|
return mAccessibilityManager.getRecommendedTimeoutMillis(AUTO_HIDE_TIMEOUT_MS,
|
||||||
|
FLAG_CONTENT_CONTROLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkUserAutoHide(MotionEvent event) {
|
public void checkUserAutoHide(MotionEvent event) {
|
||||||
@@ -160,7 +176,13 @@ public class AutoHideController {
|
|||||||
|
|
||||||
private void userAutoHide() {
|
private void userAutoHide() {
|
||||||
cancelAutoHide();
|
cancelAutoHide();
|
||||||
mHandler.postDelayed(mAutoHide, 350); // longer than app gesture -> flag clear
|
// longer than app gesture -> flag clear
|
||||||
|
mHandler.postDelayed(mAutoHide, getUserAutoHideTimeout());
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getUserAutoHideTimeout() {
|
||||||
|
return mAccessibilityManager.getRecommendedTimeoutMillis(USER_AUTO_HIDE_TIMEOUT_MS,
|
||||||
|
FLAG_CONTENT_CONTROLS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAnyTransientBarShown() {
|
private boolean isAnyTransientBarShown() {
|
||||||
@@ -175,6 +197,15 @@ public class AutoHideController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dump(@NonNull PrintWriter pw) {
|
||||||
|
pw.println("AutoHideController:");
|
||||||
|
pw.println("\tmAutoHideSuspended=" + mAutoHideSuspended);
|
||||||
|
pw.println("\tisAnyTransientBarShown=" + isAnyTransientBarShown());
|
||||||
|
pw.println("\thasPendingAutoHide=" + mHandler.hasCallbacks(mAutoHide));
|
||||||
|
pw.println("\tgetAutoHideTimeout=" + getAutoHideTimeout());
|
||||||
|
pw.println("\tgetUserAutoHideTimeout=" + getUserAutoHideTimeout());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injectable factory for creating a {@link AutoHideController}.
|
* Injectable factory for creating a {@link AutoHideController}.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user