resolved conflicts for merge of ef44a77f to jb-mr1-dev-plus-aosp
Change-Id: Iad4319796be4b9ad74580f8c20a4e8cb30569f87
This commit is contained in:
@@ -18,6 +18,9 @@ package com.android.internal.policy.impl.keyguard;
|
||||
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.IActivityManager.WaitResult;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -110,6 +113,27 @@ public abstract class KeyguardActivityLauncher {
|
||||
}
|
||||
}
|
||||
|
||||
public void launchWidgetPicker(int appWidgetId) {
|
||||
Intent pickIntent = new Intent(AppWidgetManager.ACTION_KEYGUARD_APPWIDGET_PICK);
|
||||
|
||||
pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
|
||||
pickIntent.putExtra(AppWidgetManager.EXTRA_CUSTOM_SORT, false);
|
||||
pickIntent.putExtra(AppWidgetManager.EXTRA_CATEGORY_FILTER,
|
||||
AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD);
|
||||
|
||||
Bundle options = new Bundle();
|
||||
options.putInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY,
|
||||
AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD);
|
||||
pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS, options);
|
||||
pickIntent.addFlags(
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
| Intent.FLAG_ACTIVITY_SINGLE_TOP
|
||||
| Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
|
||||
|
||||
launchActivity(pickIntent, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches the said intent for the current foreground user.
|
||||
* @param intent
|
||||
@@ -118,8 +142,8 @@ public abstract class KeyguardActivityLauncher {
|
||||
*/
|
||||
public void launchActivity(final Intent intent, boolean showsWhileLocked, boolean animate) {
|
||||
final Context context = getContext();
|
||||
final Bundle animation = animate ? null :
|
||||
ActivityOptions.makeCustomAnimation(context, 0, 0).toBundle();
|
||||
final Bundle animation = animate ? null
|
||||
: ActivityOptions.makeCustomAnimation(context, 0, 0).toBundle();
|
||||
LockPatternUtils lockPatternUtils = getLockPatternUtils();
|
||||
intent.addFlags(
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
|
||||
@@ -33,12 +33,10 @@ import android.content.pm.UserInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.os.SystemClock;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
@@ -888,14 +886,12 @@ public class KeyguardHostView extends KeyguardViewBase {
|
||||
addWidgetButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mCallback.setOnDismissRunnable(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
launchPickActivityIntent();
|
||||
}
|
||||
});
|
||||
mCallback.dismiss(false);
|
||||
int appWidgetId = mAppWidgetHost.allocateAppWidgetId();
|
||||
if (appWidgetId != -1) {
|
||||
mActivityLauncher.launchWidgetPicker(appWidgetId);
|
||||
} else {
|
||||
Log.e(TAG, "Unable to allocate an AppWidget id in lock screen");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -903,33 +899,6 @@ public class KeyguardHostView extends KeyguardViewBase {
|
||||
initializeTransportControl();
|
||||
}
|
||||
|
||||
private void launchPickActivityIntent() {
|
||||
// Create intent to pick widget
|
||||
Intent pickIntent = new Intent(AppWidgetManager.ACTION_KEYGUARD_APPWIDGET_PICK);
|
||||
|
||||
int appWidgetId = mAppWidgetHost.allocateAppWidgetId();
|
||||
if (appWidgetId != -1) {
|
||||
pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
|
||||
pickIntent.putExtra(AppWidgetManager.EXTRA_CUSTOM_SORT, false);
|
||||
pickIntent.putExtra(AppWidgetManager.EXTRA_CATEGORY_FILTER,
|
||||
AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD);
|
||||
|
||||
Bundle options = new Bundle();
|
||||
options.putInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY,
|
||||
AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD);
|
||||
pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS, options);
|
||||
pickIntent.addFlags(
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
| Intent.FLAG_ACTIVITY_SINGLE_TOP
|
||||
| Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
|
||||
mContext.startActivityAsUser(pickIntent,
|
||||
new UserHandle(UserHandle.USER_CURRENT));
|
||||
} else {
|
||||
Log.e(TAG, "Unable to allocate an AppWidget id in lock screen");
|
||||
}
|
||||
}
|
||||
|
||||
private void removeTransportFromWidgetPager() {
|
||||
int page = getWidgetPosition(R.id.keyguard_transport_control);
|
||||
if (page != -1) {
|
||||
|
||||
Reference in New Issue
Block a user