@@ -62,6 +62,7 @@ public class KeyguardHostView extends KeyguardViewBase {
6262 // Use this to debug all of keyguard
6363 public static boolean DEBUG = KeyguardViewMediator .DEBUG ;
6464
65+ // Found in KeyguardAppWidgetPickActivity.java
6566 static final int APPWIDGET_HOST_ID = 0x4B455947 ;
6667
6768 private AppWidgetHost mAppWidgetHost ;
@@ -956,12 +957,8 @@ private void addDefaultWidgets() {
956957 addWidgetButton .setOnClickListener (new OnClickListener () {
957958 @ Override
958959 public void onClick (View v ) {
959- int appWidgetId = mAppWidgetHost .allocateAppWidgetId ();
960- if (appWidgetId != -1 ) {
961- mActivityLauncher .launchWidgetPicker (appWidgetId );
962- } else {
963- Log .e (TAG , "Unable to allocate an AppWidget id in lock screen" );
964- }
960+ // Pass in an invalid widget id... the picker will allocate an ID for us
961+ mActivityLauncher .launchWidgetPicker (AppWidgetManager .INVALID_APPWIDGET_ID );
965962 }
966963 });
967964 }
@@ -1262,15 +1259,6 @@ private CameraWidgetFrame findCameraPage() {
12621259 return null ;
12631260 }
12641261
1265- private boolean isWidgetPage (int pageIndex ) {
1266- View v = mAppWidgetContainer .getChildAt (pageIndex );
1267- if (v != null && v instanceof KeyguardWidgetFrame ) {
1268- KeyguardWidgetFrame kwf = (KeyguardWidgetFrame ) v ;
1269- return kwf .getContentAppWidgetId () != AppWidgetManager .INVALID_APPWIDGET_ID ;
1270- }
1271- return false ;
1272- }
1273-
12741262 boolean isMusicPage (int pageIndex ) {
12751263 return pageIndex >= 0 && pageIndex == getWidgetPosition (R .id .keyguard_transport_control );
12761264 }
0 commit comments