Merge "Add DISABLE_CLOCK flags to status bar, fix transitions" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
02327e4080
@@ -60,7 +60,11 @@
|
||||
|
||||
<include layout="@layout/heads_up_status_bar_layout" />
|
||||
|
||||
<!-- The alpha of the left side is controlled by PhoneStatusBarTransitions, and the
|
||||
individual views are controlled by StatusBarManager disable flags DISABLE_CLOCK and
|
||||
DISABLE_NOTIFICATION_ICONS, respectively -->
|
||||
<LinearLayout
|
||||
android:id="@+id/status_bar_left_side"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:clipChildren="false"
|
||||
@@ -76,8 +80,6 @@
|
||||
android:gravity="center_vertical|start"
|
||||
/>
|
||||
|
||||
<!-- The alpha of this area is controlled from both PhoneStatusBarTransitions and
|
||||
PhoneStatusBar (DISABLE_NOTIFICATION_ICONS). -->
|
||||
<com.android.systemui.statusbar.AlphaOptimizedFrameLayout
|
||||
android:id="@+id/notification_icon_area"
|
||||
android:layout_width="0dp"
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
package com.android.systemui.statusbar.phone;
|
||||
|
||||
import static android.app.StatusBarManager.DISABLE_CLOCK;
|
||||
import static android.app.StatusBarManager.DISABLE_NOTIFICATION_ICONS;
|
||||
import static android.app.StatusBarManager.DISABLE_SYSTEM_INFO;
|
||||
|
||||
@@ -96,6 +97,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
|
||||
mSystemIconArea = mStatusBar.findViewById(R.id.system_icon_area);
|
||||
mClockView = mStatusBar.findViewById(R.id.clock);
|
||||
showSystemIconArea(false);
|
||||
showClock(false);
|
||||
initEmergencyCryptkeeperText();
|
||||
initOperatorName();
|
||||
}
|
||||
@@ -163,6 +165,13 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
|
||||
showNotificationIconArea(animate);
|
||||
}
|
||||
}
|
||||
if ((diff1 & DISABLE_CLOCK) != 0) {
|
||||
if ((state1 & DISABLE_CLOCK) != 0) {
|
||||
hideClock(animate);
|
||||
} else {
|
||||
showClock(animate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int adjustDisableFlags(int state) {
|
||||
@@ -171,6 +180,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
|
||||
&& shouldHideNotificationIcons()) {
|
||||
state |= DISABLE_NOTIFICATION_ICONS;
|
||||
state |= DISABLE_SYSTEM_INFO;
|
||||
state |= DISABLE_CLOCK;
|
||||
}
|
||||
if (mNetworkController != null && EncryptionHelper.IS_DATA_ENCRYPTED) {
|
||||
if (mNetworkController.hasEmergencyCryptKeeperText()) {
|
||||
@@ -195,11 +205,17 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
|
||||
|
||||
public void hideSystemIconArea(boolean animate) {
|
||||
animateHide(mSystemIconArea, animate);
|
||||
animateHide(mClockView, animate);
|
||||
}
|
||||
|
||||
public void showSystemIconArea(boolean animate) {
|
||||
animateShow(mSystemIconArea, animate);
|
||||
}
|
||||
|
||||
public void hideClock(boolean animate) {
|
||||
animateHide(mClockView, animate);
|
||||
}
|
||||
|
||||
public void showClock(boolean animate) {
|
||||
animateShow(mClockView, animate);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,9 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
|
||||
}
|
||||
|
||||
public void init() {
|
||||
mLeftSide = mView.findViewById(R.id.notification_icon_area);
|
||||
mLeftSide = mView.findViewById(R.id.status_bar_left_side);
|
||||
mStatusIcons = mView.findViewById(R.id.statusIcons);
|
||||
mBattery = mView.findViewById(R.id.battery);
|
||||
mClock = mView.findViewById(R.id.clock);
|
||||
applyModeBackground(-1, getMode(), false /*animate*/);
|
||||
applyMode(getMode(), false /*animate*/);
|
||||
}
|
||||
@@ -89,8 +88,7 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
|
||||
anims.playTogether(
|
||||
animateTransitionTo(mLeftSide, newAlpha),
|
||||
animateTransitionTo(mStatusIcons, newAlpha),
|
||||
animateTransitionTo(mBattery, newAlphaBC),
|
||||
animateTransitionTo(mClock, newAlphaBC)
|
||||
animateTransitionTo(mBattery, newAlphaBC)
|
||||
);
|
||||
if (isLightsOut(mode)) {
|
||||
anims.setDuration(LIGHTS_OUT_DURATION);
|
||||
@@ -101,7 +99,6 @@ public final class PhoneStatusBarTransitions extends BarTransitions {
|
||||
mLeftSide.setAlpha(newAlpha);
|
||||
mStatusIcons.setAlpha(newAlpha);
|
||||
mBattery.setAlpha(newAlphaBC);
|
||||
mClock.setAlpha(newAlphaBC);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -89,15 +89,11 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest {
|
||||
|
||||
assertEquals(View.INVISIBLE, mFragment.getView().findViewById(R.id.system_icon_area)
|
||||
.getVisibility());
|
||||
assertEquals(View.INVISIBLE, mFragment.getView().findViewById(R.id.clock)
|
||||
.getVisibility());
|
||||
|
||||
fragment.disable(0, 0, false);
|
||||
|
||||
assertEquals(View.VISIBLE, mFragment.getView().findViewById(R.id.system_icon_area)
|
||||
.getVisibility());
|
||||
assertEquals(View.VISIBLE, mFragment.getView().findViewById(R.id.clock)
|
||||
.getVisibility());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -115,4 +111,20 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest {
|
||||
|
||||
Mockito.verify(mNotificationAreaInner, atLeast(1)).setVisibility(eq(View.VISIBLE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisableClock() throws Exception {
|
||||
mFragments.dispatchResume();
|
||||
processAllMessages();
|
||||
|
||||
CollapsedStatusBarFragment fragment = (CollapsedStatusBarFragment) mFragment;
|
||||
fragment.initNotificationIconArea(mMockNotificiationAreaController);
|
||||
fragment.disable(StatusBarManager.DISABLE_CLOCK, 0, false);
|
||||
|
||||
assertEquals(View.INVISIBLE, mFragment.getView().findViewById(R.id.clock).getVisibility());
|
||||
|
||||
fragment.disable(0, 0, false);
|
||||
|
||||
assertEquals(View.VISIBLE, mFragment.getView().findViewById(R.id.clock).getVisibility());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user