Merge "Animate pinned stack resizing."
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index a3c615d..e4e97a1 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -30,6 +30,7 @@
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.content.pm.UserInfo;
import android.graphics.Bitmap;
import android.net.ProxyInfo;
import android.net.Uri;
@@ -5346,6 +5347,22 @@
}
/**
+ * Called by the system to obtain a {@link DevicePolicyManager} whose calls act on the parent
+ * profile.
+ *
+ * @hide
+ */
+ public DevicePolicyManager getParentProfileInstance(UserInfo uInfo) {
+ mContext.checkSelfPermission(
+ android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS);
+ if (!uInfo.isManagedProfile()) {
+ throw new SecurityException("The user " + uInfo.id
+ + " does not have a parent profile.");
+ }
+ return new DevicePolicyManager(mContext, true);
+ }
+
+ /**
* Called by a profile owner of a managed profile to set the color used for customization.
* This color is used as background color of the confirm credentials screen for that user.
* The default color is {@link android.graphics.Color#GRAY}.
diff --git a/core/java/android/content/SharedPreferences.java b/core/java/android/content/SharedPreferences.java
index 1d16516..7f9e176 100644
--- a/core/java/android/content/SharedPreferences.java
+++ b/core/java/android/content/SharedPreferences.java
@@ -30,8 +30,7 @@
* when they are committed to storage. Objects that are returned from the
* various <code>get</code> methods must be treated as immutable by the application.
*
- * <p><em>Note: currently this class does not support use across multiple
- * processes. This will be added later.</em>
+ * <p><em>Note: This class does not support use across multiple processes.</em>
*
* <div class="special reference">
* <h3>Developer Guides</h3>
diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java
index dedf07f5..91a8e0a 100644
--- a/core/java/android/content/pm/ActivityInfo.java
+++ b/core/java/android/content/pm/ActivityInfo.java
@@ -156,6 +156,35 @@
public String targetActivity;
/**
+ * Activity can not be resized and always occupies the fullscreen area with all windows fully
+ * visible.
+ * @hide
+ */
+ public static final int RESIZE_MODE_UNRESIZEABLE = 0;
+ /**
+ * Activity can not be resized and always occupies the fullscreen area with all windows cropped
+ * to either the task or stack bounds.
+ * @hide
+ */
+ public static final int RESIZE_MODE_CROP_WINDOWS = 1;
+ /**
+ * Activity is resizeable.
+ * @hide
+ */
+ public static final int RESIZE_MODE_RESIZEABLE = 2;
+ /**
+ * Activity is resizeable and supported picture-in-picture mode.
+ * @hide
+ */
+ public static final int RESIZE_MODE_RESIZEABLE_AND_PIPABLE = 3;
+ /**
+ * Value indicating if the resizing mode the activity supports.
+ * See {@link android.R.attr#resizeableActivity}.
+ * @hide
+ */
+ public int resizeMode;
+
+ /**
* Bit in {@link #flags} indicating whether this activity is able to
* run in multiple processes. If
* true, the system may instantiate it in the some process as the
@@ -283,20 +312,6 @@
public static final int FLAG_ENABLE_VR_MODE = 0x8000;
/**
- * Bit in {@link #flags} indicating if the activity is resizeable to any dimension.
- * See {@link android.R.attr#resizeableActivity}.
- * @hide
- */
- public static final int FLAG_RESIZEABLE = 0x10000;
-
- /**
- * Bit in {@link #flags} indicating if the activity is supports picture-in-picture form of
- * multi-window mode. See {@link android.R.attr#supportsPictureInPicture}.
- * @hide
- */
- public static final int FLAG_SUPPORTS_PICTURE_IN_PICTURE = 0x20000;
-
- /**
* Bit in {@link #flags} indicating if the activity is always focusable regardless of if it is
* in a task/stack whose activities are normally not focusable.
* See android.R.attr#alwaysFocusable.
@@ -746,6 +761,7 @@
maxRecents = orig.maxRecents;
lockTaskLaunchMode = orig.lockTaskLaunchMode;
layout = orig.layout;
+ resizeMode = orig.resizeMode;
}
/**
@@ -768,6 +784,22 @@
}
}
+ /** @hide */
+ public static final String resizeModeToString(int mode) {
+ switch (mode) {
+ case RESIZE_MODE_UNRESIZEABLE:
+ return "RESIZE_MODE_UNRESIZEABLE";
+ case RESIZE_MODE_CROP_WINDOWS:
+ return "RESIZE_MODE_CROP_WINDOWS";
+ case RESIZE_MODE_RESIZEABLE:
+ return "RESIZE_MODE_RESIZEABLE";
+ case RESIZE_MODE_RESIZEABLE_AND_PIPABLE:
+ return "RESIZE_MODE_RESIZEABLE_AND_PIPABLE";
+ default:
+ return "unknown=" + mode;
+ }
+ }
+
public void dump(Printer pw, String prefix) {
dump(pw, prefix, DUMP_FLAG_ALL);
}
@@ -806,6 +838,7 @@
+ layout.widthFraction + ", " + layout.height + "|"
+ layout.heightFraction + ", " + layout.gravity);
}
+ pw.println(prefix + "resizeMode=" + resizeModeToString(resizeMode));
super.dumpBack(pw, prefix, flags);
}
@@ -847,6 +880,7 @@
} else {
dest.writeInt(0);
}
+ dest.writeInt(resizeMode);
}
public static final Parcelable.Creator<ActivityInfo> CREATOR
@@ -879,6 +913,7 @@
if (source.readInt() == 1) {
layout = new Layout(source);
}
+ resizeMode = source.readInt();
}
public static final class Layout {
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index a6fec9f..9319c2e 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -16,15 +16,12 @@
package android.content.pm;
-import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_BAD_MANIFEST;
-import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME;
-import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING;
-import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES;
-import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
-import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_NOT_APK;
-import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_NO_CERTIFICATES;
-import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION;
-import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER;
+import com.android.internal.R;
+import com.android.internal.util.ArrayUtils;
+import com.android.internal.util.XmlUtils;
+
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
import android.app.ActivityManager;
import android.content.ComponentName;
@@ -55,15 +52,6 @@
import android.util.jar.StrictJarFile;
import android.view.Gravity;
-import com.android.internal.R;
-import com.android.internal.util.ArrayUtils;
-import com.android.internal.util.XmlUtils;
-
-import libcore.io.IoUtils;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -87,6 +75,25 @@
import java.util.concurrent.atomic.AtomicReference;
import java.util.zip.ZipEntry;
+import libcore.io.IoUtils;
+
+import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE;
+import static android.content.pm.ActivityInfo.FLAG_IMMERSIVE;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_CROP_WINDOWS;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
+import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
+import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_BAD_MANIFEST;
+import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME;
+import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING;
+import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES;
+import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED;
+import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_NOT_APK;
+import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_NO_CERTIFICATES;
+import static android.content.pm.PackageManager.INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION;
+import static android.os.Trace.TRACE_TAG_PACKAGE_MANAGER;
+
/**
* Parser for package files (APKs) on disk. This supports apps packaged either
* as a single "monolithic" APK, or apps packaged as a "cluster" of multiple
@@ -3219,24 +3226,29 @@
a.info.flags |= ActivityInfo.FLAG_RESUME_WHILE_PAUSING;
}
- if (sa.getBoolean(R.styleable.AndroidManifestActivity_resizeableActivity,
- owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.N)) {
- a.info.flags |= ActivityInfo.FLAG_RESIZEABLE;
+ a.info.screenOrientation = sa.getInt(
+ R.styleable.AndroidManifestActivity_screenOrientation,
+ SCREEN_ORIENTATION_UNSPECIFIED);
- if (sa.getBoolean(R.styleable.AndroidManifestActivity_supportsPictureInPicture,
- false)) {
- a.info.flags |= ActivityInfo.FLAG_SUPPORTS_PICTURE_IN_PICTURE;
+ a.info.resizeMode = RESIZE_MODE_UNRESIZEABLE;
+ if (owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.N) {
+ if (sa.getBoolean(R.styleable.AndroidManifestActivity_resizeableActivity, true)) {
+ if (sa.getBoolean(R.styleable.AndroidManifestActivity_supportsPictureInPicture,
+ false)) {
+ a.info.resizeMode = RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
+ } else {
+ a.info.resizeMode = RESIZE_MODE_RESIZEABLE;
+ }
}
+ } else if (a.info.screenOrientation == SCREEN_ORIENTATION_UNSPECIFIED
+ && (a.info.flags & FLAG_IMMERSIVE) == 0) {
+ a.info.resizeMode = RESIZE_MODE_CROP_WINDOWS;
}
if (sa.getBoolean(R.styleable.AndroidManifestActivity_alwaysFocusable, false)) {
- a.info.flags |= ActivityInfo.FLAG_ALWAYS_FOCUSABLE;
+ a.info.flags |= FLAG_ALWAYS_FOCUSABLE;
}
- a.info.screenOrientation = sa.getInt(
- R.styleable.AndroidManifestActivity_screenOrientation,
- ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
-
a.info.lockTaskLaunchMode =
sa.getInt(R.styleable.AndroidManifestActivity_lockTaskMode, 0);
@@ -3478,6 +3490,7 @@
info.parentActivityName = target.info.parentActivityName;
info.maxRecents = target.info.maxRecents;
info.layout = target.info.layout;
+ info.resizeMode = target.info.resizeMode;
Activity a = new Activity(mParseActivityAliasArgs, info);
if (outError[0] != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/chooser/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
similarity index 95%
rename from packages/SystemUI/src/com/android/systemui/chooser/ChooserActivity.java
rename to core/java/com/android/internal/app/ChooserActivity.java
index a8bc36e..2733391 100644
--- a/packages/SystemUI/src/com/android/systemui/chooser/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package com.android.systemui.chooser;
+package com.android.internal.app;
import android.animation.ObjectAnimator;
import android.annotation.NonNull;
@@ -25,7 +25,6 @@
import android.content.IntentSender;
import android.content.IntentSender.SendIntentException;
import android.content.ServiceConnection;
-import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.LabeledIntent;
import android.content.pm.PackageManager;
@@ -36,7 +35,6 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.os.Bundle;
-import android.os.Environment;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
@@ -67,12 +65,9 @@
import android.widget.BaseAdapter;
import android.widget.ListView;
import com.android.internal.R;
-import com.android.internal.app.IntentForwarderActivity;
-import com.android.internal.app.ResolverActivity;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
-import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -96,11 +91,6 @@
private ChooserListAdapter mChooserListAdapter;
private ChooserRowAdapter mChooserRowAdapter;
- private SharedPreferences mPinnedSharedPrefs;
- private static final float PINNED_TARGET_SCORE_BOOST = 1000.f;
- private static final String PINNED_SHARED_PREFS_NAME = "chooser_pin_settings";
- private static final String TARGET_DETAILS_FRAGMENT_TAG = "targetDetailsFragment";
-
private final List<ChooserTargetServiceConnection> mServiceConnections = new ArrayList<>();
private static final int CHOOSER_TARGET_SERVICE_RESULT = 1;
@@ -217,18 +207,12 @@
mRefinementIntentSender = intent.getParcelableExtra(
Intent.EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER);
setSafeForwardingMode(true);
-
- mPinnedSharedPrefs = getPinnedSharedPrefs(this);
super.onCreate(savedInstanceState, target, title, defaultTitleRes, initialIntents,
null, false);
MetricsLogger.action(this, MetricsEvent.ACTION_ACTIVITY_CHOOSER_SHOWN);
}
- static SharedPreferences getPinnedSharedPrefs(Context context) {
- return context.getSharedPreferences(PINNED_SHARED_PREFS_NAME, MODE_PRIVATE);
- }
-
@Override
protected void onDestroy() {
super.onDestroy();
@@ -259,7 +243,7 @@
}
@Override
- public void onActivityStarted(TargetInfo cti) {
+ void onActivityStarted(TargetInfo cti) {
if (mChosenComponentSender != null) {
final ComponentName target = cti.getResolvedComponentName();
if (target != null) {
@@ -275,7 +259,7 @@
}
@Override
- public void onPrepareAdapterView(AbsListView adapterView, ResolveListAdapter adapter,
+ void onPrepareAdapterView(AbsListView adapterView, ResolveListAdapter adapter,
boolean alwaysUseOption) {
final ListView listView = adapterView instanceof ListView ? (ListView) adapterView : null;
mChooserListAdapter = (ChooserListAdapter) adapter;
@@ -288,17 +272,17 @@
}
@Override
- public int getLayoutResource() {
+ int getLayoutResource() {
return R.layout.chooser_grid;
}
@Override
- public boolean shouldGetActivityMetadata() {
+ boolean shouldGetActivityMetadata() {
return true;
}
@Override
- public boolean shouldAutoLaunchSingleChoice(TargetInfo target) {
+ boolean shouldAutoLaunchSingleChoice(TargetInfo target) {
final Intent intent = target.getResolvedIntent();
final ResolveInfo resolve = target.getResolveInfo();
@@ -315,16 +299,6 @@
return false;
}
- @Override
- public void showTargetDetails(ResolveInfo ri) {
- ComponentName name = ri.activityInfo.getComponentName();
- boolean pinned = mPinnedSharedPrefs.getBoolean(name.flattenToString(), false);
- ResolverTargetActionsDialogFragment f =
- new ResolverTargetActionsDialogFragment(ri.loadLabel(getPackageManager()),
- name, pinned);
- f.show(getFragmentManager(), TARGET_DETAILS_FRAGMENT_TAG);
- }
-
private void modifyTargetIntent(Intent in) {
final String action = in.getAction();
if (Intent.ACTION_SEND.equals(action) ||
@@ -366,7 +340,7 @@
}
@Override
- public void startSelected(int which, boolean always, boolean filtered) {
+ void startSelected(int which, boolean always, boolean filtered) {
super.startSelected(which, always, filtered);
if (mChooserListAdapter != null) {
@@ -497,7 +471,7 @@
mChooserHandler.removeMessages(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT);
}
- public void onSetupVoiceInteraction() {
+ void onSetupVoiceInteraction() {
// Do nothing. We'll send the voice stuff ourselves.
}
@@ -569,7 +543,7 @@
}
@Override
- public ResolveListAdapter createAdapter(Context context, List<Intent> payloadIntents,
+ ResolveListAdapter createAdapter(Context context, List<Intent> payloadIntents,
Intent[] initialIntents, List<ResolveInfo> rList, int launchedFromUid,
boolean filterLastUsed) {
final ChooserListAdapter adapter = new ChooserListAdapter(context, payloadIntents,
@@ -737,11 +711,6 @@
}
return results;
}
-
- @Override
- public boolean isPinned() {
- return mSourceInfo != null ? mSourceInfo.isPinned() : false;
- }
}
public class ChooserListAdapter extends ResolveListAdapter {
@@ -808,20 +777,6 @@
}
@Override
- public boolean isComponentPinned(ComponentName name) {
- return mPinnedSharedPrefs.getBoolean(name.flattenToString(), false);
- }
-
- @Override
- public float getScore(DisplayResolveInfo target) {
- float score = super.getScore(target);
- if (target.isPinned()) {
- score += PINNED_TARGET_SCORE_BOOST;
- }
- return score;
- }
-
- @Override
public View onCreateView(ViewGroup parent) {
return mInflater.inflate(
com.android.internal.R.layout.resolve_grid_item, parent, false);
@@ -1166,7 +1121,7 @@
v.setOnLongClickListener(new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
- showTargetDetails(
+ showAppDetails(
mChooserListAdapter.resolveInfoForPosition(
holder.itemIndices[column], true));
return true;
diff --git a/core/java/com/android/internal/app/IntentForwarderActivity.java b/core/java/com/android/internal/app/IntentForwarderActivity.java
index 1244987..dbec740 100644
--- a/core/java/com/android/internal/app/IntentForwarderActivity.java
+++ b/core/java/com/android/internal/app/IntentForwarderActivity.java
@@ -100,7 +100,7 @@
final boolean shouldShowDisclosure = ri == null || ri.activityInfo == null ||
!"android".equals(ri.activityInfo.packageName) ||
!(ResolverActivity.class.getName().equals(ri.activityInfo.name)
- || "com.android.systemui.chooser.ChooserActivity".equals(ri.activityInfo.name));
+ || ChooserActivity.class.getName().equals(ri.activityInfo.name));
try {
startActivityAsCaller(newIntent, null, false, targetUserId);
diff --git a/core/java/com/android/internal/app/ResolverActivity.java b/core/java/com/android/internal/app/ResolverActivity.java
index 7eb8708..ec148c55 100644
--- a/core/java/com/android/internal/app/ResolverActivity.java
+++ b/core/java/com/android/internal/app/ResolverActivity.java
@@ -22,7 +22,6 @@
import android.app.VoiceInteractor.PickOptionRequest;
import android.app.VoiceInteractor.PickOptionRequest.Option;
import android.app.VoiceInteractor.Prompt;
-import android.content.pm.ComponentInfo;
import android.os.AsyncTask;
import android.provider.Settings;
import android.text.TextUtils;
@@ -337,12 +336,12 @@
/**
* Perform any initialization needed for voice interaction.
*/
- public void onSetupVoiceInteraction() {
+ void onSetupVoiceInteraction() {
// Do it right now. Subclasses may delay this and send it later.
sendVoiceChoicesIfNeeded();
}
- public void sendVoiceChoicesIfNeeded() {
+ void sendVoiceChoicesIfNeeded() {
if (!isVoiceInteraction()) {
// Clearly not needed.
return;
@@ -383,7 +382,7 @@
return null;
}
- public int getLayoutResource() {
+ int getLayoutResource() {
return R.layout.resolver_list;
}
@@ -592,7 +591,7 @@
mAlwaysUseOption);
}
- public void startSelected(int which, boolean always, boolean filtered) {
+ void startSelected(int which, boolean always, boolean filtered) {
if (isFinishing()) {
return;
}
@@ -762,7 +761,7 @@
return true;
}
- public void safelyStartActivity(TargetInfo cti) {
+ void safelyStartActivity(TargetInfo cti) {
// If needed, show that intent is forwarded
// from managed profile to owner or other way around.
if (mProfileSwitchMessageId != -1) {
@@ -792,26 +791,26 @@
}
}
- public void onActivityStarted(TargetInfo cti) {
+ void onActivityStarted(TargetInfo cti) {
// Do nothing
}
- public boolean shouldGetActivityMetadata() {
+ boolean shouldGetActivityMetadata() {
return false;
}
- public boolean shouldAutoLaunchSingleChoice(TargetInfo target) {
+ boolean shouldAutoLaunchSingleChoice(TargetInfo target) {
return true;
}
- public void showTargetDetails(ResolveInfo ri) {
+ void showAppDetails(ResolveInfo ri) {
Intent in = new Intent().setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
.setData(Uri.fromParts("package", ri.activityInfo.packageName, null))
.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
startActivity(in);
}
- public ResolveListAdapter createAdapter(Context context, List<Intent> payloadIntents,
+ ResolveListAdapter createAdapter(Context context, List<Intent> payloadIntents,
Intent[] initialIntents, List<ResolveInfo> rList, int launchedFromUid,
boolean filterLastUsed) {
return new ResolveListAdapter(context, payloadIntents, initialIntents, rList,
@@ -821,7 +820,7 @@
/**
* Returns true if the activity is finishing and creation should halt
*/
- public boolean configureContentView(List<Intent> payloadIntents, Intent[] initialIntents,
+ boolean configureContentView(List<Intent> payloadIntents, Intent[] initialIntents,
List<ResolveInfo> rList, boolean alwaysUseOption) {
// The last argument of createAdapter is whether to do special handling
// of the last used choice to highlight it in the list. We need to always
@@ -868,7 +867,7 @@
return false;
}
- public void onPrepareAdapterView(AbsListView adapterView, ResolveListAdapter adapter,
+ void onPrepareAdapterView(AbsListView adapterView, ResolveListAdapter adapter,
boolean alwaysUseOption) {
final boolean useHeader = adapter.hasFilteredItem();
final ListView listView = adapterView instanceof ListView ? (ListView) adapterView : null;
@@ -899,7 +898,7 @@
&& Objects.equals(lhs.activityInfo.packageName, rhs.activityInfo.packageName);
}
- public final class DisplayResolveInfo implements TargetInfo {
+ final class DisplayResolveInfo implements TargetInfo {
private final ResolveInfo mResolveInfo;
private final CharSequence mDisplayLabel;
private Drawable mDisplayIcon;
@@ -907,9 +906,8 @@
private final CharSequence mExtendedInfo;
private final Intent mResolvedIntent;
private final List<Intent> mSourceIntents = new ArrayList<>();
- private boolean mPinned;
- public DisplayResolveInfo(Intent originalIntent, ResolveInfo pri, CharSequence pLabel,
+ DisplayResolveInfo(Intent originalIntent, ResolveInfo pri, CharSequence pLabel,
CharSequence pInfo, Intent pOrigIntent) {
mSourceIntents.add(originalIntent);
mResolveInfo = pri;
@@ -934,7 +932,6 @@
mExtendedInfo = other.mExtendedInfo;
mResolvedIntent = new Intent(other.mResolvedIntent);
mResolvedIntent.fillIn(fillInIntent, flags);
- mPinned = other.mPinned;
}
public ResolveInfo getResolveInfo() {
@@ -1029,15 +1026,6 @@
activity.startActivityAsUser(mResolvedIntent, options, user);
return false;
}
-
- @Override
- public boolean isPinned() {
- return mPinned;
- }
-
- public void setPinned(boolean pinned) {
- mPinned = pinned;
- }
}
/**
@@ -1051,7 +1039,7 @@
*
* @return the resolved intent for this target
*/
- Intent getResolvedIntent();
+ public Intent getResolvedIntent();
/**
* Get the resolved component name that represents this target. Note that this may not
@@ -1060,7 +1048,7 @@
*
* @return the resolved ComponentName for this target
*/
- ComponentName getResolvedComponentName();
+ public ComponentName getResolvedComponentName();
/**
* Start the activity referenced by this target.
@@ -1069,7 +1057,7 @@
* @param options ActivityOptions bundle
* @return true if the start completed successfully
*/
- boolean start(Activity activity, Bundle options);
+ public boolean start(Activity activity, Bundle options);
/**
* Start the activity referenced by this target as if the ResolverActivity's caller
@@ -1080,7 +1068,7 @@
* @param userId userId to start as or {@link UserHandle#USER_NULL} for activity's caller
* @return true if the start completed successfully
*/
- boolean startAsCaller(Activity activity, Bundle options, int userId);
+ public boolean startAsCaller(Activity activity, Bundle options, int userId);
/**
* Start the activity referenced by this target as a given user.
@@ -1090,7 +1078,7 @@
* @param user handle for the user to start the activity as
* @return true if the start completed successfully
*/
- boolean startAsUser(Activity activity, Bundle options, UserHandle user);
+ public boolean startAsUser(Activity activity, Bundle options, UserHandle user);
/**
* Return the ResolveInfo about how and why this target matched the original query
@@ -1098,14 +1086,14 @@
*
* @return ResolveInfo representing this target's match
*/
- ResolveInfo getResolveInfo();
+ public ResolveInfo getResolveInfo();
/**
* Return the human-readable text label for this target.
*
* @return user-visible target label
*/
- CharSequence getDisplayLabel();
+ public CharSequence getDisplayLabel();
/**
* Return any extended info for this target. This may be used to disambiguate
@@ -1113,40 +1101,35 @@
*
* @return human-readable disambig string or null if none present
*/
- CharSequence getExtendedInfo();
+ public CharSequence getExtendedInfo();
/**
* @return The drawable that should be used to represent this target
*/
- Drawable getDisplayIcon();
+ public Drawable getDisplayIcon();
/**
* @return The (small) icon to badge the target with
*/
- Drawable getBadgeIcon();
+ public Drawable getBadgeIcon();
/**
* @return The content description for the badge icon
*/
- CharSequence getBadgeContentDescription();
+ public CharSequence getBadgeContentDescription();
/**
* Clone this target with the given fill-in information.
*/
- TargetInfo cloneFilledIn(Intent fillInIntent, int flags);
+ public TargetInfo cloneFilledIn(Intent fillInIntent, int flags);
/**
* @return the list of supported source intents deduped against this single target
*/
- List<Intent> getAllSourceIntents();
-
- /**
- * @return true if this target should be pinned to the front by the request of the user
- */
- boolean isPinned();
+ public List<Intent> getAllSourceIntents();
}
- public class ResolveListAdapter extends BaseAdapter {
+ class ResolveListAdapter extends BaseAdapter {
private final List<Intent> mIntents;
private final Intent[] mInitialIntents;
private final List<ResolveInfo> mBaseResolveList;
@@ -1393,12 +1376,9 @@
}
}
if (!found) {
- final ComponentName name = new ComponentName(
- newInfo.activityInfo.packageName, newInfo.activityInfo.name);
- final ResolvedComponentInfo rci = new ResolvedComponentInfo(name,
- intent, newInfo);
- rci.setPinned(isComponentPinned(name));
- into.add(rci);
+ into.add(new ResolvedComponentInfo(new ComponentName(
+ newInfo.activityInfo.packageName, newInfo.activityInfo.name),
+ intent, newInfo));
}
}
}
@@ -1474,8 +1454,6 @@
final Intent replaceIntent = getReplacementIntent(add.activityInfo, intent);
final DisplayResolveInfo dri = new DisplayResolveInfo(intent, add, roLabel,
extraInfo, replaceIntent);
- final ComponentInfo ci = add.getComponentInfo();
- dri.setPinned(rci.isPinned());
addResolveInfo(dri);
if (replaceIntent == intent) {
// Only add alternates if we didn't get a specific replacement from
@@ -1559,11 +1537,11 @@
return false;
}
- public int getDisplayResolveInfoCount() {
+ protected int getDisplayResolveInfoCount() {
return mDisplayList.size();
}
- public DisplayResolveInfo getDisplayResolveInfo(int index) {
+ protected DisplayResolveInfo getDisplayResolveInfo(int index) {
// Used to query services. We only query services for primary targets, not alternates.
return mDisplayList.get(index);
}
@@ -1593,10 +1571,6 @@
return !TextUtils.isEmpty(info.getExtendedInfo());
}
- public boolean isComponentPinned(ComponentName name) {
- return false;
- }
-
public final void bindView(int position, View view) {
onBindView(view, getItem(position));
}
@@ -1633,7 +1607,6 @@
static final class ResolvedComponentInfo {
public final ComponentName name;
- private boolean mPinned;
private final List<Intent> mIntents = new ArrayList<>();
private final List<ResolveInfo> mResolveInfos = new ArrayList<>();
@@ -1676,14 +1649,6 @@
}
return -1;
}
-
- public boolean isPinned() {
- return mPinned;
- }
-
- public void setPinned(boolean pinned) {
- mPinned = pinned;
- }
}
static class ViewHolder {
@@ -1737,7 +1702,7 @@
return false;
}
ResolveInfo ri = mAdapter.resolveInfoForPosition(position, true);
- showTargetDetails(ri);
+ showAppDetails(ri);
return true;
}
diff --git a/core/java/com/android/internal/app/ResolverComparator.java b/core/java/com/android/internal/app/ResolverComparator.java
index 964a7f5..31556e2 100644
--- a/core/java/com/android/internal/app/ResolverComparator.java
+++ b/core/java/com/android/internal/app/ResolverComparator.java
@@ -48,7 +48,7 @@
private static final boolean DEBUG = false;
// Two weeks
- private static final long USAGE_STATS_PERIOD = 1000 * 60 * 60 * 24 * 7;
+ private static final long USAGE_STATS_PERIOD = 1000 * 60 * 60 * 24 * 14;
private static final long RECENCY_TIME_PERIOD = 1000 * 60 * 60 * 12;
@@ -171,27 +171,15 @@
}
}
- final boolean lPinned = lhsp.isPinned();
- final boolean rPinned = rhsp.isPinned();
+ if (mStats != null) {
+ final ScoredTarget lhsTarget = mScoredTargets.get(new ComponentName(
+ lhs.activityInfo.packageName, lhs.activityInfo.name));
+ final ScoredTarget rhsTarget = mScoredTargets.get(new ComponentName(
+ rhs.activityInfo.packageName, rhs.activityInfo.name));
+ final float diff = rhsTarget.score - lhsTarget.score;
- if (lPinned && !rPinned) {
- return -1;
- } else if (!lPinned && rPinned) {
- return 1;
- }
-
- // Pinned items stay stable within a normal lexical sort and ignore scoring.
- if (!lPinned && !rPinned) {
- if (mStats != null) {
- final ScoredTarget lhsTarget = mScoredTargets.get(new ComponentName(
- lhs.activityInfo.packageName, lhs.activityInfo.name));
- final ScoredTarget rhsTarget = mScoredTargets.get(new ComponentName(
- rhs.activityInfo.packageName, rhs.activityInfo.name));
- final float diff = rhsTarget.score - lhsTarget.score;
-
- if (diff != 0) {
- return diff > 0 ? 1 : -1;
- }
+ if (diff != 0) {
+ return diff > 0 ? 1 : -1;
}
}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 4ab81e9..1c3db10 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -2887,6 +2887,19 @@
android:theme="@style/Theme.Material.DayNight.DarkActionBar"
android:forceDeviceEncrypted="true"
android:encryptionAware="true">
+ <activity android:name="com.android.internal.app.ChooserActivity"
+ android:theme="@style/Theme.DeviceDefault.Resolver"
+ android:finishOnCloseSystemDialogs="true"
+ android:excludeFromRecents="true"
+ android:documentLaunchMode="never"
+ android:relinquishTaskIdentity="true"
+ android:process=":ui">
+ <intent-filter>
+ <action android:name="android.intent.action.CHOOSER" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.VOICE" />
+ </intent-filter>
+ </activity>
<activity android:name="com.android.internal.app.IntentForwarderActivity"
android:finishOnCloseSystemDialogs="true"
android:theme="@style/Theme.NoDisplay"
diff --git a/core/res/res/layout/app_error_dialog.xml b/core/res/res/layout/app_error_dialog.xml
index aaa2dbc..46a2b2a 100644
--- a/core/res/res/layout/app_error_dialog.xml
+++ b/core/res/res/layout/app_error_dialog.xml
@@ -26,7 +26,7 @@
>
- <TextView
+ <Button
android:id="@+id/aerr_restart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -34,7 +34,7 @@
style="@style/aerr_list_item"
/>
- <TextView
+ <Button
android:id="@+id/aerr_reset"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -42,7 +42,7 @@
style="@style/aerr_list_item"
/>
- <TextView
+ <Button
android:id="@+id/aerr_report"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -50,7 +50,7 @@
style="@style/aerr_list_item"
/>
- <TextView
+ <Button
android:id="@+id/aerr_close"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -58,7 +58,7 @@
style="@style/aerr_list_item"
/>
- <TextView
+ <Button
android:id="@+id/aerr_mute"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index b660277..f0960c7 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -1398,7 +1398,7 @@
</style>
<!-- @hide -->
- <style name="aerr_list_item" parent="Widget.Material.Light.TextView">
+ <style name="aerr_list_item" parent="Widget.Material.Light.Button.Borderless">
<item name="minHeight">?attr/listPreferredItemHeightSmall</item>
<item name="textAppearance">?attr/textAppearanceListItemSmall</item>
<item name="textColor">?attr/textColorAlertDialogListItem</item>
diff --git a/packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtils.java b/packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtils.java
index d3c1364..ad567d3 100644
--- a/packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtils.java
+++ b/packages/SettingsLib/src/com/android/settingslib/RestrictedLockUtils.java
@@ -178,7 +178,7 @@
if (userInfo.isManagedProfile()) {
// If userInfo.id is a managed profile, we also need to look at
// the policies set on the parent.
- DevicePolicyManager parentDpm = dpm.getParentProfileInstance(admin);
+ DevicePolicyManager parentDpm = dpm.getParentProfileInstance(userInfo);
if ((parentDpm.getKeyguardDisabledFeatures(admin, userInfo.id)
& keyguardFeatures) != 0) {
if (enforcedAdmin == null) {
@@ -375,7 +375,7 @@
if (userInfo.isManagedProfile()) {
// If userInfo.id is a managed profile, we also need to look at
// the policies set on the parent.
- DevicePolicyManager parentDpm = dpm.getParentProfileInstance(admin);
+ DevicePolicyManager parentDpm = dpm.getParentProfileInstance(userInfo);
if (parentDpm.getMaximumTimeToLock(admin, userInfo.id) > 0) {
if (enforcedAdmin == null) {
enforcedAdmin = new EnforcedAdmin(admin, userInfo.id);
diff --git a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
index 2ee4b12..5b8ed28 100644
--- a/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
+++ b/packages/SettingsLib/src/com/android/settingslib/wifi/AccessPoint.java
@@ -37,6 +37,7 @@
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
+import android.support.annotation.NonNull;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
@@ -104,7 +105,8 @@
private static final int PSK_WPA2 = 2;
private static final int PSK_WPA_WPA2 = 3;
- private static final int VISIBILITY_OUTDATED_AGE_IN_MILLI = 20000;
+ public static final int SIGNAL_LEVELS = 4;
+
private final Context mContext;
private String ssid;
@@ -167,7 +169,7 @@
}
@Override
- public int compareTo(AccessPoint other) {
+ public int compareTo(@NonNull AccessPoint other) {
// Active one goes first.
if (isActive() && !other.isActive()) return -1;
if (!isActive() && other.isActive()) return 1;
@@ -182,8 +184,9 @@
if (networkId == WifiConfiguration.INVALID_NETWORK_ID
&& other.networkId != WifiConfiguration.INVALID_NETWORK_ID) return 1;
- // Sort by signal strength.
- int difference = WifiManager.compareSignalLevel(other.mRssi, mRssi);
+ // Sort by signal strength, bucketed by level
+ int difference = WifiManager.calculateSignalLevel(other.mRssi, SIGNAL_LEVELS)
+ - WifiManager.calculateSignalLevel(mRssi, SIGNAL_LEVELS);
if (difference != 0) {
return difference;
}
@@ -260,7 +263,7 @@
if (mRssi == Integer.MAX_VALUE) {
return -1;
}
- return WifiManager.calculateSignalLevel(mRssi, 4);
+ return WifiManager.calculateSignalLevel(mRssi, SIGNAL_LEVELS);
}
public int getRssi() {
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 52b7b7d..21abb90 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -155,10 +155,6 @@
<!-- TV picture-in-picture -->
<uses-permission android:name="android.permission.RECEIVE_MEDIA_RESOURCE_USAGE" />
- <!-- ChooserActivity -->
- <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
- <uses-permission android:name="android.permission.BIND_CHOOSER_TARGET_SERVICE" />
-
<application
android:name=".SystemUIApplication"
android:persistent="true"
@@ -442,20 +438,5 @@
<action android:name="com.android.systemui.action.CLEAR_TUNER" />
</intent-filter>
</receiver>
-
- <activity android:name=".chooser.ChooserActivity"
- android:theme="@*android:style/Theme.DeviceDefault.Resolver"
- android:finishOnCloseSystemDialogs="true"
- android:excludeFromRecents="true"
- android:documentLaunchMode="never"
- android:relinquishTaskIdentity="true"
- android:process=":chooser">
- <intent-filter>
- <action android:name="android.intent.action.CHOOSER" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.VOICE" />
- </intent-filter>
- </activity>
-
</application>
</manifest>
diff --git a/packages/SystemUI/res/values/arrays.xml b/packages/SystemUI/res/values/arrays.xml
index 32025e0..bf0cba2 100644
--- a/packages/SystemUI/res/values/arrays.xml
+++ b/packages/SystemUI/res/values/arrays.xml
@@ -51,16 +51,4 @@
<item>0</item><item>3</item>
<item>3</item><item>3</item>
</array>
-
- <!-- Used in ResolverTargetActionsDialogFragment -->
- <string-array name="resolver_target_actions_pin">
- <item>@string/pin_target</item>
- <item>@string/app_info</item>
- </string-array>
-
- <string-array name="resolver_target_actions_unpin">
- <item>@string/unpin_target</item>
- <item>@string/app_info</item>
- </string-array>
-
</resources>
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 7824291..32da3c6 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1343,11 +1343,6 @@
<!-- Accessibility description for data saver being off [CHAR LIMIT=NONE] -->
<string name="accessibility_data_saver_off">Data Saver is off</string>
- <!-- Resolver target actions strings -->
- <string name="pin_target">Pin</string>
- <string name="unpin_target">Unpin</string>
- <string name="app_info">App info</string>
-
<!-- Label for feature switch [CHAR LIMIT=30] -->
<string name="switch_bar_on">On</string>
diff --git a/packages/SystemUI/src/com/android/systemui/chooser/ResolverTargetActionsDialogFragment.java b/packages/SystemUI/src/com/android/systemui/chooser/ResolverTargetActionsDialogFragment.java
deleted file mode 100644
index 839aa45..0000000
--- a/packages/SystemUI/src/com/android/systemui/chooser/ResolverTargetActionsDialogFragment.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package com.android.systemui.chooser;
-
-import android.app.AlertDialog.Builder;
-import android.app.Dialog;
-import android.app.DialogFragment;
-import android.content.ComponentName;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.net.Uri;
-import android.os.Bundle;
-import android.provider.Settings;
-
-import com.android.systemui.R;
-
-/**
- * Shows a dialog with actions to take on a chooser target
- */
-public class ResolverTargetActionsDialogFragment extends DialogFragment
- implements DialogInterface.OnClickListener {
- private static final String NAME_KEY = "componentName";
- private static final String PINNED_KEY = "pinned";
- private static final String TITLE_KEY = "title";
-
- // Sync with R.array.resolver_target_actions_* resources
- private static final int TOGGLE_PIN_INDEX = 0;
- private static final int APP_INFO_INDEX = 1;
-
- public ResolverTargetActionsDialogFragment() {
- }
-
- public ResolverTargetActionsDialogFragment(CharSequence title, ComponentName name,
- boolean pinned) {
- Bundle args = new Bundle();
- args.putCharSequence(TITLE_KEY, title);
- args.putParcelable(NAME_KEY, name);
- args.putBoolean(PINNED_KEY, pinned);
- setArguments(args);
- }
-
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- final Bundle args = getArguments();
- final int itemRes = args.getBoolean(PINNED_KEY, false)
- ? R.array.resolver_target_actions_unpin
- : R.array.resolver_target_actions_pin;
- return new Builder(getContext())
- .setCancelable(true)
- .setItems(itemRes, this)
- .setTitle(args.getCharSequence(TITLE_KEY))
- .create();
- }
-
- @Override
- public void onClick(DialogInterface dialog, int which) {
- final Bundle args = getArguments();
- ComponentName name = args.getParcelable(NAME_KEY);
- switch (which) {
- case TOGGLE_PIN_INDEX:
- SharedPreferences sp = ChooserActivity.getPinnedSharedPrefs(getContext());
- final String key = name.flattenToString();
- boolean currentVal = sp.getBoolean(name.flattenToString(), false);
- if (currentVal) {
- sp.edit().remove(key).apply();
- } else {
- sp.edit().putBoolean(key, true).apply();
- }
-
- // Force the chooser to requery and resort things
- getActivity().recreate();
- break;
- case APP_INFO_INDEX:
- Intent in = new Intent().setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
- .setData(Uri.fromParts("package", name.getPackageName(), null))
- .addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
- startActivity(in);
- break;
- }
- dismiss();
- }
-}
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index 71008a9..d1fcd3b 100755
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -19,8 +19,9 @@
import static android.app.ActivityManager.StackId;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE;
-import static android.content.pm.ActivityInfo.FLAG_RESIZEABLE;
-import static android.content.pm.ActivityInfo.FLAG_SUPPORTS_PICTURE_IN_PICTURE;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_CROP_WINDOWS;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_CONFIGURATION;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_SAVED_STATE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_SWITCH;
@@ -355,6 +356,9 @@
if (connections != null) {
pw.print(prefix); pw.print("connections="); pw.println(connections);
}
+ if (info != null) {
+ pw.println(prefix + "resizeMode=" + ActivityInfo.resizeModeToString(info.resizeMode));
+ }
}
public boolean crossesHorizontalSizeThreshold(int firstDp, int secondDp) {
@@ -754,11 +758,16 @@
}
boolean isResizeable() {
- return (info.flags & FLAG_RESIZEABLE) != 0;
+ return !isHomeActivity() && (info.resizeMode == RESIZE_MODE_RESIZEABLE
+ || info.resizeMode == RESIZE_MODE_RESIZEABLE_AND_PIPABLE);
}
boolean supportsPictureInPicture() {
- return (info.flags & FLAG_SUPPORTS_PICTURE_IN_PICTURE) != 0;
+ return !isHomeActivity() && info.resizeMode == RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
+ }
+
+ boolean cropAppWindows() {
+ return !isHomeActivity() && info.resizeMode == RESIZE_MODE_CROP_WINDOWS;
}
boolean isAlwaysFocusable() {
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index ef8d230..3e99558 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -1410,14 +1410,11 @@
}
if (mStackId == DOCKED_STACK_ID) {
- // Docked stack is always visible, except in the case where the home activity
- // is the top running activity in the focused home stack.
- if (focusedStackId != HOME_STACK_ID) {
- return STACK_VISIBLE;
- }
- ActivityRecord topHomeActivity = focusedStack.topRunningActivityLocked();
- return topHomeActivity == null || !topHomeActivity.isHomeActivity() ?
- STACK_VISIBLE : STACK_INVISIBLE;
+ // Docked stack is always visible, except in the case where the top running activity in
+ // the focus stack doesn't support any form of resizing.
+ final ActivityRecord r = focusedStack.topRunningActivityLocked();
+ return r == null || r.isResizeable() || r.cropAppWindows()
+ ? STACK_VISIBLE : STACK_INVISIBLE;
}
// Find the first stack below focused stack that actually got something visible.
@@ -4819,7 +4816,7 @@
r.task.taskId, mStackId, r.info.screenOrientation, r.fullscreen,
(r.info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0, r.userId, r.info.configChanges,
task.voiceSession != null, r.mLaunchTaskBehind, bounds, task.mOverrideConfig,
- !r.isHomeActivity(), r.isAlwaysFocusable());
+ r.cropAppWindows() | r.isResizeable(), r.isAlwaysFocusable());
mWindowManager.setTaskResizeable(task.taskId, task.mResizeable);
r.taskConfigOverride = task.mOverrideConfig;
}
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index fd787df..c9d4595 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -24,7 +24,8 @@
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
import static android.content.Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS;
-import static android.content.pm.ActivityInfo.FLAG_RESIZEABLE;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
+import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_ALWAYS;
import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_DEFAULT;
import static android.content.pm.ActivityInfo.LOCK_TASK_LAUNCH_MODE_IF_WHITELISTED;
@@ -447,7 +448,9 @@
} else {
autoRemoveRecents = false;
}
- mResizeable = (info.flags & FLAG_RESIZEABLE) != 0 || mService.mForceResizableActivities;
+ mResizeable = info.resizeMode == RESIZE_MODE_RESIZEABLE
+ || info.resizeMode == RESIZE_MODE_RESIZEABLE_AND_PIPABLE
+ || mService.mForceResizableActivities;
mLockTaskMode = info.lockTaskLaunchMode;
mPrivileged = (info.applicationInfo.privateFlags & PRIVATE_FLAG_PRIVILEGED) != 0;
setLockTaskAuth();