Requesting ApplicationInfo in cached object
Bug: 363324203 Test: Presubmit Flag: EXEMPT refactor Change-Id: I92f3d3ed8c267b895dc439ba1f01eb67d7f63965
This commit is contained in:
@@ -26,6 +26,7 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentSender;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.LauncherActivityInfo;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.content.pm.PackageManager;
|
||||
@@ -43,6 +44,7 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.icons.ComponentWithLabelAndIcon;
|
||||
import com.android.launcher3.icons.IconCache;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.util.ApplicationInfoWrapper;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -58,10 +60,20 @@ public abstract class ShortcutConfigActivityInfo implements ComponentWithLabelAn
|
||||
|
||||
private final ComponentName mCn;
|
||||
private final UserHandle mUser;
|
||||
private final ApplicationInfoWrapper mInfoWrapper;
|
||||
|
||||
protected ShortcutConfigActivityInfo(ComponentName cn, UserHandle user) {
|
||||
protected ShortcutConfigActivityInfo(
|
||||
ComponentName cn, UserHandle user, ApplicationInfoWrapper infoWrapper) {
|
||||
mCn = cn;
|
||||
mUser = user;
|
||||
mInfoWrapper = infoWrapper;
|
||||
}
|
||||
|
||||
protected ShortcutConfigActivityInfo(
|
||||
ComponentName cn, UserHandle user, Context context) {
|
||||
mCn = cn;
|
||||
mUser = user;
|
||||
mInfoWrapper = new ApplicationInfoWrapper(context, cn.getPackageName(), user);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,6 +101,12 @@ public abstract class ShortcutConfigActivityInfo implements ComponentWithLabelAn
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ApplicationInfo getApplicationInfo() {
|
||||
return mInfoWrapper.getInfo();
|
||||
}
|
||||
|
||||
public boolean startConfigActivity(Activity activity, int requestCode) {
|
||||
Intent intent = new Intent(Intent.ACTION_CREATE_SHORTCUT)
|
||||
.setComponent(getComponent());
|
||||
@@ -120,7 +138,8 @@ public abstract class ShortcutConfigActivityInfo implements ComponentWithLabelAn
|
||||
private final LauncherActivityInfo mInfo;
|
||||
|
||||
public ShortcutConfigActivityInfoVO(LauncherActivityInfo info) {
|
||||
super(info.getComponentName(), info.getUser());
|
||||
super(info.getComponentName(), info.getUser(),
|
||||
new ApplicationInfoWrapper(info.getApplicationInfo()));
|
||||
mInfo = info;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user