Fix issue with AutoInstallsLayout Parser and user profile
=> the profileId was only being added from the root workspace parser => instead, the profileId should be added at the individual item parser level Flag: NONE small bug fix Issue: 390674545 Test: manually verified using import / export Change-Id: I76187b1210f282d1a0f8f4652a499d2472461d87
This commit is contained in:
@@ -261,6 +261,13 @@ public class AutoInstallsLayout {
|
||||
return count;
|
||||
}
|
||||
|
||||
private void addProfileId(XmlPullParser parser) {
|
||||
Long profileId = mUserTypeToSerial.get(getAttributeValue(parser, ATTR_USER_TYPE));
|
||||
if (profileId != null) {
|
||||
mValues.put(Favorites.PROFILE_ID, profileId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses container and screenId attribute from the current tag, and puts it in the out.
|
||||
* @param out array of size 2.
|
||||
@@ -305,10 +312,6 @@ public class AutoInstallsLayout {
|
||||
convertToDistanceFromEnd(getAttributeValue(parser, ATTR_X), mColumnCount));
|
||||
mValues.put(Favorites.CELLY,
|
||||
convertToDistanceFromEnd(getAttributeValue(parser, ATTR_Y), mRowCount));
|
||||
Long profileId = mUserTypeToSerial.get(getAttributeValue(parser, ATTR_USER_TYPE));
|
||||
if (profileId != null) {
|
||||
mValues.put(Favorites.PROFILE_ID, profileId);
|
||||
}
|
||||
|
||||
TagParser tagParser = tagParserMap.get(parser.getName());
|
||||
if (tagParser == null) {
|
||||
@@ -382,7 +385,7 @@ public class AutoInstallsLayout {
|
||||
public int parseAndAdd(XmlPullParser parser) {
|
||||
final String packageName = getAttributeValue(parser, ATTR_PACKAGE_NAME);
|
||||
final String className = getAttributeValue(parser, ATTR_CLASS_NAME);
|
||||
|
||||
addProfileId(parser);
|
||||
if (!TextUtils.isEmpty(packageName) && !TextUtils.isEmpty(className)) {
|
||||
ActivityInfo info;
|
||||
try {
|
||||
@@ -431,6 +434,7 @@ public class AutoInstallsLayout {
|
||||
public int parseAndAdd(XmlPullParser parser) {
|
||||
final String packageName = getAttributeValue(parser, ATTR_PACKAGE_NAME);
|
||||
final String className = getAttributeValue(parser, ATTR_CLASS_NAME);
|
||||
addProfileId(parser);
|
||||
if (TextUtils.isEmpty(packageName) || TextUtils.isEmpty(className)) {
|
||||
if (LOGD) Log.d(TAG, "Skipping invalid <favorite> with no component");
|
||||
return -1;
|
||||
@@ -452,7 +456,7 @@ public class AutoInstallsLayout {
|
||||
public int parseAndAdd(XmlPullParser parser) {
|
||||
final String packageName = getAttributeValue(parser, ATTR_PACKAGE_NAME);
|
||||
final String shortcutId = getAttributeValue(parser, ATTR_SHORTCUT_ID);
|
||||
|
||||
addProfileId(parser);
|
||||
try {
|
||||
LauncherApps launcherApps = mContext.getSystemService(LauncherApps.class);
|
||||
launcherApps.pinShortcuts(packageName, Collections.singletonList(shortcutId),
|
||||
@@ -482,13 +486,13 @@ public class AutoInstallsLayout {
|
||||
public ComponentName getComponentName(XmlPullParser parser) {
|
||||
final String packageName = getAttributeValue(parser, ATTR_PACKAGE_NAME);
|
||||
final String className = getAttributeValue(parser, ATTR_CLASS_NAME);
|
||||
addProfileId(parser);
|
||||
if (TextUtils.isEmpty(packageName) || TextUtils.isEmpty(className)) {
|
||||
return null;
|
||||
}
|
||||
return new ComponentName(packageName, className);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int parseAndAdd(XmlPullParser parser)
|
||||
throws XmlPullParserException, IOException {
|
||||
|
||||
@@ -136,4 +136,4 @@ object LayoutImportExportHelper {
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user