Merge "Attempt to fix missing transport control in keyguard" into jb-mr1-dev
This commit is contained in:
@@ -32,9 +32,6 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false">
|
android:clipToPadding="false">
|
||||||
<!-- TODO: Remove this when supported as a widget -->
|
|
||||||
<include layout="@layout/keyguard_status_view"/>
|
|
||||||
<include layout="@layout/keyguard_transport_control_view"/>
|
|
||||||
</com.android.internal.policy.impl.keyguard.KeyguardWidgetPager>
|
</com.android.internal.policy.impl.keyguard.KeyguardWidgetPager>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -1331,6 +1331,8 @@
|
|||||||
<java-symbol type="layout" name="screen_title" />
|
<java-symbol type="layout" name="screen_title" />
|
||||||
<java-symbol type="layout" name="screen_title_icons" />
|
<java-symbol type="layout" name="screen_title_icons" />
|
||||||
<java-symbol type="layout" name="keyguard_host_view" />
|
<java-symbol type="layout" name="keyguard_host_view" />
|
||||||
|
<java-symbol type="layout" name="keyguard_transport_control_view" />
|
||||||
|
<java-symbol type="layout" name="keyguard_status_view" />
|
||||||
<java-symbol type="string" name="abbrev_wday_month_day_no_year" />
|
<java-symbol type="string" name="abbrev_wday_month_day_no_year" />
|
||||||
<java-symbol type="string" name="android_upgrading_title" />
|
<java-symbol type="string" name="android_upgrading_title" />
|
||||||
<java-symbol type="string" name="bugreport_title" />
|
<java-symbol type="string" name="bugreport_title" />
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ public class KeyguardHostView extends KeyguardViewBase {
|
|||||||
private AppWidgetHost mAppWidgetHost;
|
private AppWidgetHost mAppWidgetHost;
|
||||||
private KeyguardWidgetPager mAppWidgetContainer;
|
private KeyguardWidgetPager mAppWidgetContainer;
|
||||||
private ViewFlipper mSecurityViewContainer;
|
private ViewFlipper mSecurityViewContainer;
|
||||||
|
private KeyguardTransportControlView mTransportControl;
|
||||||
private boolean mEnableMenuKey;
|
private boolean mEnableMenuKey;
|
||||||
private boolean mIsVerifyUnlockOnly;
|
private boolean mIsVerifyUnlockOnly;
|
||||||
private boolean mEnableFallback; // TODO: This should get the value from KeyguardPatternView
|
private boolean mEnableFallback; // TODO: This should get the value from KeyguardPatternView
|
||||||
@@ -80,7 +81,6 @@ public class KeyguardHostView extends KeyguardViewBase {
|
|||||||
private KeyguardSecurityModel mSecurityModel;
|
private KeyguardSecurityModel mSecurityModel;
|
||||||
|
|
||||||
private Rect mTempRect = new Rect();
|
private Rect mTempRect = new Rect();
|
||||||
private KeyguardTransportControlView mTransportControl;
|
|
||||||
|
|
||||||
/*package*/ interface TransportCallback {
|
/*package*/ interface TransportCallback {
|
||||||
void hide();
|
void hide();
|
||||||
@@ -145,45 +145,7 @@ public class KeyguardHostView extends KeyguardViewBase {
|
|||||||
kgwr.setVisibility(VISIBLE);
|
kgwr.setVisibility(VISIBLE);
|
||||||
mSecurityViewContainer = (ViewFlipper) findViewById(R.id.view_flipper);
|
mSecurityViewContainer = (ViewFlipper) findViewById(R.id.view_flipper);
|
||||||
|
|
||||||
// This code manages showing/hiding the transport control. We keep it around and only
|
addDefaultWidgets();
|
||||||
// add it to the hierarchy if it needs to be present.
|
|
||||||
mTransportControl =
|
|
||||||
(KeyguardTransportControlView) findViewById(R.id.keyguard_transport_control);
|
|
||||||
if (mTransportControl != null) {
|
|
||||||
mTransportControl.setKeyguardCallback(new TransportCallback() {
|
|
||||||
boolean mSticky = false;
|
|
||||||
@Override
|
|
||||||
public void hide() {
|
|
||||||
int page = getWidgetPosition(R.id.keyguard_transport_control);
|
|
||||||
if (page != -1 && !mSticky) {
|
|
||||||
if (page == mAppWidgetContainer.getCurrentPage()) {
|
|
||||||
// Switch back to clock view if music was showing.
|
|
||||||
mAppWidgetContainer
|
|
||||||
.setCurrentPage(getWidgetPosition(R.id.keyguard_status_view));
|
|
||||||
}
|
|
||||||
mAppWidgetContainer.removeView(mTransportControl);
|
|
||||||
// XXX keep view attached to hierarchy so we still get show/hide events
|
|
||||||
// from AudioManager
|
|
||||||
KeyguardHostView.this.addView(mTransportControl);
|
|
||||||
mTransportControl.setVisibility(View.GONE);
|
|
||||||
showAppropriateWidgetPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void show() {
|
|
||||||
if (getWidgetPosition(R.id.keyguard_transport_control) == -1) {
|
|
||||||
KeyguardHostView.this.removeView(mTransportControl);
|
|
||||||
mAppWidgetContainer.addView(mTransportControl,
|
|
||||||
getWidgetPosition(R.id.keyguard_status_view) + 1);
|
|
||||||
mTransportControl.setVisibility(View.VISIBLE);
|
|
||||||
// Once shown, leave it showing
|
|
||||||
mSticky = true;
|
|
||||||
showAppropriateWidgetPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
updateSecurityViews();
|
updateSecurityViews();
|
||||||
setSystemUiVisibility(getSystemUiVisibility() | View.STATUS_BAR_DISABLE_BACK);
|
setSystemUiVisibility(getSystemUiVisibility() | View.STATUS_BAR_DISABLE_BACK);
|
||||||
}
|
}
|
||||||
@@ -702,6 +664,52 @@ public class KeyguardHostView extends KeyguardViewBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addDefaultWidgets() {
|
||||||
|
LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||||
|
inflater.inflate(R.layout.keyguard_status_view, mAppWidgetContainer, true);
|
||||||
|
inflater.inflate(R.layout.keyguard_transport_control_view, mAppWidgetContainer, true);
|
||||||
|
|
||||||
|
mTransportControl =
|
||||||
|
(KeyguardTransportControlView) findViewById(R.id.keyguard_transport_control);
|
||||||
|
|
||||||
|
|
||||||
|
// This code manages showing/hiding the transport control. We keep it around and only
|
||||||
|
// add it to the hierarchy if it needs to be present.
|
||||||
|
if (mTransportControl != null) {
|
||||||
|
mTransportControl.setKeyguardCallback(new TransportCallback() {
|
||||||
|
boolean mSticky = false;
|
||||||
|
@Override
|
||||||
|
public void hide() {
|
||||||
|
int page = getWidgetPosition(R.id.keyguard_transport_control);
|
||||||
|
if (page != -1 && !mSticky) {
|
||||||
|
if (page == mAppWidgetContainer.getCurrentPage()) {
|
||||||
|
// Switch back to clock view if music was showing.
|
||||||
|
mAppWidgetContainer
|
||||||
|
.setCurrentPage(getWidgetPosition(R.id.keyguard_status_view));
|
||||||
|
}
|
||||||
|
mAppWidgetContainer.removeView(mTransportControl);
|
||||||
|
// XXX keep view attached to hierarchy so we still get show/hide events
|
||||||
|
// from AudioManager
|
||||||
|
KeyguardHostView.this.addView(mTransportControl);
|
||||||
|
mTransportControl.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
if (getWidgetPosition(R.id.keyguard_transport_control) == -1) {
|
||||||
|
KeyguardHostView.this.removeView(mTransportControl);
|
||||||
|
mAppWidgetContainer.addView(mTransportControl,
|
||||||
|
getWidgetPosition(R.id.keyguard_status_view) + 1);
|
||||||
|
mTransportControl.setVisibility(View.VISIBLE);
|
||||||
|
// Once shown, leave it showing
|
||||||
|
mSticky = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void maybePopulateWidgets() {
|
private void maybePopulateWidgets() {
|
||||||
DevicePolicyManager dpm =
|
DevicePolicyManager dpm =
|
||||||
(DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
|
(DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||||
|
|||||||
Reference in New Issue
Block a user