Merge "Enable 3 button nav for taskbar" into sc-v2-dev
This commit is contained in:
@@ -27,7 +27,6 @@ import android.hardware.display.DisplayManager;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.SystemProperties;
|
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
@@ -235,27 +234,28 @@ public class NavigationBarController implements Callbacks,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** @see #initializeTaskbarIfNecessary() */
|
||||||
* @return {@code true} if navbar was added/removed, false otherwise
|
private boolean updateNavbarForTaskbar() {
|
||||||
*/
|
boolean taskbarShown = initializeTaskbarIfNecessary();
|
||||||
public boolean updateNavbarForTaskbar() {
|
if (!taskbarShown && mNavigationBars.get(mContext.getDisplayId()) == null) {
|
||||||
if (!isThreeButtonTaskbarFlagEnabled()) {
|
createNavigationBar(mContext.getDisplay(), null, null);
|
||||||
return false;
|
}
|
||||||
|
return taskbarShown;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIsTablet && mNavMode == NAV_BAR_MODE_3BUTTON) {
|
/** @return {@code true} if taskbar is enabled, false otherwise */
|
||||||
|
private boolean initializeTaskbarIfNecessary() {
|
||||||
|
boolean isShowingTaskbar = mIsTablet && mNavMode == NAV_BAR_MODE_3BUTTON;
|
||||||
|
if (isShowingTaskbar) {
|
||||||
// Remove navigation bar when taskbar is showing, currently only for 3 button mode
|
// Remove navigation bar when taskbar is showing, currently only for 3 button mode
|
||||||
removeNavigationBar(mContext.getDisplayId());
|
removeNavigationBar(mContext.getDisplayId());
|
||||||
mCommandQueue.addCallback(mTaskbarDelegate);
|
mCommandQueue.addCallback(mTaskbarDelegate);
|
||||||
mTaskbarDelegate.init(mContext.getDisplayId());
|
mTaskbarDelegate.init(mContext.getDisplayId());
|
||||||
} else if (mNavigationBars.get(mContext.getDisplayId()) == null) {
|
} else {
|
||||||
// Add navigation bar after taskbar goes away
|
|
||||||
createNavigationBar(mContext.getDisplay(), null, null);
|
|
||||||
mCommandQueue.removeCallback(mTaskbarDelegate);
|
mCommandQueue.removeCallback(mTaskbarDelegate);
|
||||||
mTaskbarDelegate.destroy();
|
mTaskbarDelegate.destroy();
|
||||||
}
|
}
|
||||||
|
return isShowingTaskbar;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -302,7 +302,7 @@ public class NavigationBarController implements Callbacks,
|
|||||||
*/
|
*/
|
||||||
public void createNavigationBars(final boolean includeDefaultDisplay,
|
public void createNavigationBars(final boolean includeDefaultDisplay,
|
||||||
RegisterStatusBarResult result) {
|
RegisterStatusBarResult result) {
|
||||||
if (updateNavbarForTaskbar()) {
|
if (initializeTaskbarIfNecessary()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,7 +326,7 @@ public class NavigationBarController implements Callbacks,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isThreeButtonTaskbarEnabled()) {
|
if (mIsTablet && mNavMode == NAV_BAR_MODE_3BUTTON) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -461,15 +461,6 @@ public class NavigationBarController implements Callbacks,
|
|||||||
return mNavigationBars.get(DEFAULT_DISPLAY);
|
return mNavigationBars.get(DEFAULT_DISPLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isThreeButtonTaskbarEnabled() {
|
|
||||||
return mIsTablet && mNavMode == NAV_BAR_MODE_3BUTTON &&
|
|
||||||
isThreeButtonTaskbarFlagEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isThreeButtonTaskbarFlagEnabled() {
|
|
||||||
return SystemProperties.getBoolean("persist.debug.taskbar_three_button", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isTablet(Configuration newConfig) {
|
private boolean isTablet(Configuration newConfig) {
|
||||||
float density = Resources.getSystem().getDisplayMetrics().density;
|
float density = Resources.getSystem().getDisplayMetrics().density;
|
||||||
int size = Math.min((int) (density * newConfig.screenWidthDp),
|
int size = Math.min((int) (density * newConfig.screenWidthDp),
|
||||||
|
|||||||
Reference in New Issue
Block a user