Fixing UI leaks when using inline-subclass
Bug: 364363493 Flag: EXEMPT bug fix Test: Presubmit Change-Id: I8881569b021ab3737130d6d07ff3383dfab8df35
This commit is contained in:
@@ -74,7 +74,8 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch
|
||||
TYPE_TASKBAR_ALL_APPS,
|
||||
TYPE_ADD_TO_HOME_CONFIRMATION,
|
||||
TYPE_TASKBAR_OVERLAY_PROXY,
|
||||
TYPE_TASKBAR_PINNING_POPUP
|
||||
TYPE_TASKBAR_PINNING_POPUP,
|
||||
TYPE_PIN_IME_POPUP
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface FloatingViewType {}
|
||||
|
||||
@@ -51,6 +51,7 @@ import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.logger.LauncherAtom;
|
||||
import com.android.launcher3.logger.LauncherAtom.AllAppsContainer;
|
||||
import com.android.launcher3.logger.LauncherAtom.Attribute;
|
||||
import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
|
||||
import com.android.launcher3.logger.LauncherAtom.PredictionContainer;
|
||||
import com.android.launcher3.logger.LauncherAtom.SettingsContainer;
|
||||
@@ -67,6 +68,9 @@ import com.android.launcher3.util.SettingsCache;
|
||||
import com.android.launcher3.util.UserIconInfo;
|
||||
import com.android.systemui.shared.system.SysUiStatsLog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -187,6 +191,12 @@ public class ItemInfo {
|
||||
@NonNull
|
||||
public UserHandle user;
|
||||
|
||||
@NonNull
|
||||
private ExtendedContainers mExtendedContainers = ExtendedContainers.getDefaultInstance();
|
||||
|
||||
@NonNull
|
||||
private List<Attribute> mAttributeList = Collections.EMPTY_LIST;
|
||||
|
||||
public ItemInfo() {
|
||||
user = Process.myUserHandle();
|
||||
}
|
||||
@@ -433,6 +443,7 @@ public class ItemInfo {
|
||||
UserCache.INSTANCE.executeIfCreated(cache ->
|
||||
itemBuilder.setUserType(getUserType(cache.getUserInfo(user))));
|
||||
itemBuilder.setRank(rank);
|
||||
itemBuilder.addAllItemAttributes(mAttributeList);
|
||||
return itemBuilder;
|
||||
}
|
||||
|
||||
@@ -491,7 +502,7 @@ public class ItemInfo {
|
||||
default:
|
||||
if (container <= EXTENDED_CONTAINERS) {
|
||||
return ContainerInfo.newBuilder()
|
||||
.setExtendedContainers(getExtendedContainer())
|
||||
.setExtendedContainers(mExtendedContainers)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -499,12 +510,21 @@ public class ItemInfo {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns non-AOSP container wrapped by {@link ExtendedContainers} object. Should be overridden
|
||||
* by build variants.
|
||||
* Sets extra container info wrapped by {@link ExtendedContainers} object.
|
||||
*/
|
||||
@NonNull
|
||||
protected ExtendedContainers getExtendedContainer() {
|
||||
return ExtendedContainers.getDefaultInstance();
|
||||
public void setExtendedContainers(@NonNull ExtendedContainers extendedContainers) {
|
||||
mExtendedContainers = extendedContainers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds extra attributes to be added during logs
|
||||
*/
|
||||
public void addLogAttributes(List<LauncherAtom.Attribute> attributeList) {
|
||||
if (mAttributeList.isEmpty()) {
|
||||
mAttributeList = new ArrayList<>(attributeList);
|
||||
} else {
|
||||
mAttributeList.addAll(attributeList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,6 +27,7 @@ import static com.android.launcher3.widget.picker.model.data.WidgetPickerDataUti
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -342,14 +343,9 @@ public class WidgetsTwoPaneSheet extends WidgetsFullSheet {
|
||||
false);
|
||||
mSuggestedWidgetsHeader.setExpanded(true);
|
||||
|
||||
PackageItemInfo packageItemInfo = new PackageItemInfo(
|
||||
PackageItemInfo packageItemInfo = new HighresPackageItemInfo(
|
||||
/* packageName= */ SUGGESTIONS_PACKAGE_NAME,
|
||||
Process.myUserHandle()) {
|
||||
@Override
|
||||
public boolean usingLowResIcon() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
Process.myUserHandle());
|
||||
String suggestionsHeaderTitle = getContext().getString(
|
||||
R.string.suggested_widgets_header_title);
|
||||
String suggestionsRightPaneTitle = getContext().getString(
|
||||
@@ -664,4 +660,15 @@ public class WidgetsTwoPaneSheet extends WidgetsFullSheet {
|
||||
*/
|
||||
public boolean showAllWidgets = false;
|
||||
}
|
||||
|
||||
private static class HighresPackageItemInfo extends PackageItemInfo {
|
||||
HighresPackageItemInfo(String packageName, UserHandle user) {
|
||||
super(packageName, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usingLowResIcon() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user