* commit 'b93031e0a64f3ec2548063cec6ea63b54be92c93': Remove add widget transition jank (insecure).
This commit is contained in:
@@ -19,6 +19,8 @@ package com.android.internal.policy.impl.keyguard;
|
|||||||
import android.app.ActivityManagerNative;
|
import android.app.ActivityManagerNative;
|
||||||
import android.app.ActivityOptions;
|
import android.app.ActivityOptions;
|
||||||
import android.app.IActivityManager.WaitResult;
|
import android.app.IActivityManager.WaitResult;
|
||||||
|
import android.appwidget.AppWidgetManager;
|
||||||
|
import android.appwidget.AppWidgetProviderInfo;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -112,6 +114,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, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launches the said intent for the current foreground user.
|
* Launches the said intent for the current foreground user.
|
||||||
*
|
*
|
||||||
@@ -128,7 +151,8 @@ public abstract class KeyguardActivityLauncher {
|
|||||||
final Handler worker,
|
final Handler worker,
|
||||||
final Runnable onStarted) {
|
final Runnable onStarted) {
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
final Bundle animation = ActivityOptions.makeCustomAnimation(context, 0, 0).toBundle();
|
final Bundle animation = useDefaultAnimations ? null
|
||||||
|
: ActivityOptions.makeCustomAnimation(context, 0, 0).toBundle();
|
||||||
LockPatternUtils lockPatternUtils = getLockPatternUtils();
|
LockPatternUtils lockPatternUtils = getLockPatternUtils();
|
||||||
intent.addFlags(
|
intent.addFlags(
|
||||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
|||||||
@@ -33,12 +33,10 @@ import android.content.pm.UserInfo;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -898,14 +896,12 @@ public class KeyguardHostView extends KeyguardViewBase {
|
|||||||
addWidgetButton.setOnClickListener(new OnClickListener() {
|
addWidgetButton.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
mCallback.setOnDismissRunnable(new Runnable() {
|
int appWidgetId = mAppWidgetHost.allocateAppWidgetId();
|
||||||
|
if (appWidgetId != -1) {
|
||||||
@Override
|
mActivityLauncher.launchWidgetPicker(appWidgetId);
|
||||||
public void run() {
|
} else {
|
||||||
launchPickActivityIntent();
|
Log.e(TAG, "Unable to allocate an AppWidget id in lock screen");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
mCallback.dismiss(false);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -913,33 +909,6 @@ public class KeyguardHostView extends KeyguardViewBase {
|
|||||||
initializeTransportControl();
|
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() {
|
private void removeTransportFromWidgetPager() {
|
||||||
int page = getWidgetPosition(R.id.keyguard_transport_control);
|
int page = getWidgetPosition(R.id.keyguard_transport_control);
|
||||||
if (page != -1) {
|
if (page != -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user