Skip to content

Commit 12ac607

Browse files
Adam CohenAndroid (Google) Code Review
authored andcommitted
Merge "Don't disable multi-user widget when Device Policy is enabled." into jb-mr1-dev
2 parents ec7131f + 7221d3a commit 12ac607

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,18 @@ protected void onAttachedToWindow() {
181181
super.onAttachedToWindow();
182182
mAppWidgetHost.startListening();
183183
maybePopulateWidgets();
184+
disableStatusViewInteraction();
185+
showAppropriateWidgetPage();
186+
}
187+
188+
private void disableStatusViewInteraction() {
189+
// Disable all user interaction on status view. This is done to prevent falsing in the
190+
// pocket from triggering useractivity and prevents 3rd party replacement widgets
191+
// from responding to user interaction while in this position.
192+
View statusView = findViewById(R.id.keyguard_status_view);
193+
if (statusView instanceof KeyguardWidgetFrame) {
194+
((KeyguardWidgetFrame) statusView).setDisableUserInteraction(true);
195+
}
184196
}
185197

186198
@Override
@@ -684,10 +696,14 @@ private void addDefaultWidgets() {
684696
inflater.inflate(R.layout.keyguard_status_view, mAppWidgetContainer, true);
685697
inflater.inflate(R.layout.keyguard_transport_control_view, mAppWidgetContainer, true);
686698

699+
inflateAndAddUserSelectorWidgetIfNecessary();
700+
initializeTransportControl();
701+
}
702+
703+
private void initializeTransportControl() {
687704
mTransportControl =
688705
(KeyguardTransportControlView) findViewById(R.id.keyguard_transport_control);
689706

690-
691707
// This code manages showing/hiding the transport control. We keep it around and only
692708
// add it to the hierarchy if it needs to be present.
693709
if (mTransportControl != null) {
@@ -736,10 +752,8 @@ private void maybePopulateWidgets() {
736752
return;
737753
}
738754
}
739-
inflateAndAddUserSelectorWidgetIfNecessary();
740755

741-
// Add status widget
742-
View statusView = null;
756+
// Replace status widget if selected by user in Settings
743757
int statusWidgetId = mLockPatternUtils.getStatusWidget();
744758
if (statusWidgetId != -1) {
745759
addWidget(statusWidgetId);
@@ -753,16 +767,6 @@ private void maybePopulateWidgets() {
753767
mAppWidgetContainer.removeView(newStatusWidget);
754768
newStatusWidget.setId(R.id.keyguard_status_view);
755769
mAppWidgetContainer.addView(newStatusWidget, oldStatusWidgetPosition);
756-
statusView = newStatusWidget;
757-
} else {
758-
statusView = findViewById(R.id.keyguard_status_view);
759-
}
760-
761-
// Disable all user interaction on status view. This is done to prevent falsing in the
762-
// pocket from triggering useractivity and prevents 3rd party replacement widgets
763-
// from responding to user interaction while in this position.
764-
if (statusView instanceof KeyguardWidgetFrame) {
765-
((KeyguardWidgetFrame) statusView).setDisableUserInteraction(true);
766770
}
767771

768772
// Add user-selected widget
@@ -772,7 +776,6 @@ private void maybePopulateWidgets() {
772776
addWidget(widgets[i]);
773777
}
774778
}
775-
showAppropriateWidgetPage();
776779
}
777780

778781
private void showAppropriateWidgetPage() {

0 commit comments

Comments
 (0)