summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/compat
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2017-03-20 13:57:28 -0700
committerSunny Goyal <sunnygoyal@google.com>2017-03-20 15:13:51 -0700
commitb57645fcdb87847edd216e71e3b08107027e0ed3 (patch)
treed79d20c8dc7c042a49283373798d8fd23a366291 /src/com/android/launcher3/compat
parentb00fcd4e49eae98304b98bde24804dc0dedcfbee (diff)
downloadandroid_packages_apps_Trebuchet-b57645fcdb87847edd216e71e3b08107027e0ed3.tar.gz
android_packages_apps_Trebuchet-b57645fcdb87847edd216e71e3b08107027e0ed3.tar.bz2
android_packages_apps_Trebuchet-b57645fcdb87847edd216e71e3b08107027e0ed3.zip
Removing config shortcut activities for managed profiles for
apps build with older sdk > Also fixing the bug where legacy icon with primary user gets created when managed user failed to provide the new icon Bug: 34392403 Change-Id: I1d56962e9520742781df6cbeb03be2b9767a8c0b
Diffstat (limited to 'src/com/android/launcher3/compat')
-rw-r--r--src/com/android/launcher3/compat/LauncherAppsCompatVO.java9
-rw-r--r--src/com/android/launcher3/compat/PinItemRequestCompat.java5
2 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/launcher3/compat/LauncherAppsCompatVO.java b/src/com/android/launcher3/compat/LauncherAppsCompatVO.java
index 27433796a..d7e35a2e5 100644
--- a/src/com/android/launcher3/compat/LauncherAppsCompatVO.java
+++ b/src/com/android/launcher3/compat/LauncherAppsCompatVO.java
@@ -20,6 +20,8 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.LauncherActivityInfo;
import android.content.pm.LauncherApps;
+import android.os.Build;
+import android.os.Process;
import android.os.UserHandle;
import android.util.Log;
@@ -44,15 +46,20 @@ public class LauncherAppsCompatVO extends LauncherAppsCompatVL {
@Override
public List<ShortcutConfigActivityInfo> getCustomShortcutActivityList() {
List<ShortcutConfigActivityInfo> result = new ArrayList<>();
+ UserHandle myUser = Process.myUserHandle();
try {
Method m = LauncherApps.class.getDeclaredMethod("getShortcutConfigActivityList",
String.class, UserHandle.class);
for (UserHandle user : UserManagerCompat.getInstance(mContext).getUserProfiles()) {
+ boolean ignoreTargetSdk = myUser.equals(user);
List<LauncherActivityInfo> activities =
(List<LauncherActivityInfo>) m.invoke(mLauncherApps, null, user);
for (LauncherActivityInfo activityInfo : activities) {
- result.add(new ShortcutConfigActivityInfoVO(activityInfo));
+ if (ignoreTargetSdk || activityInfo.getApplicationInfo().targetSdkVersion >=
+ Build.VERSION_CODES.O) {
+ result.add(new ShortcutConfigActivityInfoVO(activityInfo));
+ }
}
}
} catch (Exception e) {
diff --git a/src/com/android/launcher3/compat/PinItemRequestCompat.java b/src/com/android/launcher3/compat/PinItemRequestCompat.java
index 550bcc327..1308cba97 100644
--- a/src/com/android/launcher3/compat/PinItemRequestCompat.java
+++ b/src/com/android/launcher3/compat/PinItemRequestCompat.java
@@ -24,6 +24,8 @@ import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
+import com.android.launcher3.Utilities;
+
/**
* A wrapper around platform implementation of PinItemRequestCompat until the
* updated SDK is available.
@@ -115,6 +117,9 @@ public class PinItemRequestCompat implements Parcelable {
};
public static PinItemRequestCompat getPinItemRequest(Intent intent) {
+ if (!Utilities.isAtLeastO()) {
+ return null;
+ }
Parcelable extra = intent.getParcelableExtra(EXTRA_PIN_ITEM_REQUEST);
return extra == null ? null : new PinItemRequestCompat(extra);
}