| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.content.pm.overlay; |
| 18 |
|
| 19 |
import android.annotation.NonNull; |
| 20 |
import android.annotation.Nullable; |
| 21 |
|
| 22 |
import com.android.internal.util.DataClass; |
| 23 |
|
| 24 |
import java.util.ArrayList; |
| 25 |
import java.util.List; |
| 26 |
import java.util.Objects; |
| 27 |
|
| 28 |
|
| 29 |
@DataClass(genConstructor = false, genBuilder = false, genHiddenBuilder = false, |
| 30 |
genEqualsHashCode = true, genToString = true) |
| 31 |
public class OverlayPaths { |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
@NonNull |
| 39 |
private final List<String> mResourceDirs = new ArrayList<>(); |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
@NonNull |
| 47 |
private final List<String> mOverlayPaths = new ArrayList<>(); |
| 48 |
|
| 49 |
public static class Builder { |
| 50 |
final OverlayPaths mPaths = new OverlayPaths(); |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
public Builder addNonApkPath(@NonNull String idmapPath) { |
| 56 |
mPaths.mOverlayPaths.add(idmapPath); |
| 57 |
return this; |
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
public Builder addApkPath(@NonNull String overlayPath) { |
| 65 |
addUniquePath(mPaths.mResourceDirs, overlayPath); |
| 66 |
addUniquePath(mPaths.mOverlayPaths, overlayPath); |
| 67 |
return this; |
| 68 |
} |
| 69 |
|
| 70 |
public Builder addAll(@Nullable OverlayPaths other) { |
| 71 |
if (other != null) { |
| 72 |
for (final String path : other.getResourceDirs()) { |
| 73 |
addUniquePath(mPaths.mResourceDirs, path); |
| 74 |
} |
| 75 |
for (final String path : other.getOverlayPaths()) { |
| 76 |
addUniquePath(mPaths.mOverlayPaths, path); |
| 77 |
} |
| 78 |
} |
| 79 |
return this; |
| 80 |
} |
| 81 |
|
| 82 |
public OverlayPaths build() { |
| 83 |
return mPaths; |
| 84 |
} |
| 85 |
|
| 86 |
private static void addUniquePath(@NonNull List<String> paths, @NonNull String path) { |
| 87 |
if (!paths.contains(path)) { |
| 88 |
paths.add(path); |
| 89 |
} |
| 90 |
} |
| 91 |
} |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
public boolean isEmpty() { |
| 97 |
return mResourceDirs.isEmpty() && mOverlayPaths.isEmpty(); |
| 98 |
} |
| 99 |
|
| 100 |
private OverlayPaths() { |
| 101 |
} |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
@DataClass.Generated.Member |
| 125 |
public @NonNull List<String> getResourceDirs() { |
| 126 |
return mResourceDirs; |
| 127 |
} |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
@DataClass.Generated.Member |
| 135 |
public @NonNull List<String> getOverlayPaths() { |
| 136 |
return mOverlayPaths; |
| 137 |
} |
| 138 |
|
| 139 |
@Override |
| 140 |
@DataClass.Generated.Member |
| 141 |
public String toString() { |
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
return "OverlayPaths { " + |
| 146 |
"resourceDirs = " + mResourceDirs + ", " + |
| 147 |
"overlayPaths = " + mOverlayPaths + |
| 148 |
" }"; |
| 149 |
} |
| 150 |
|
| 151 |
@Override |
| 152 |
@DataClass.Generated.Member |
| 153 |
public boolean equals(@android.annotation.Nullable Object o) { |
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
if (this == o) return true; |
| 159 |
if (o == null || getClass() != o.getClass()) return false; |
| 160 |
@SuppressWarnings("unchecked") |
| 161 |
OverlayPaths that = (OverlayPaths) o; |
| 162 |
|
| 163 |
return true |
| 164 |
&& Objects.equals(mResourceDirs, that.mResourceDirs) |
| 165 |
&& Objects.equals(mOverlayPaths, that.mOverlayPaths); |
| 166 |
} |
| 167 |
|
| 168 |
@Override |
| 169 |
@DataClass.Generated.Member |
| 170 |
public int hashCode() { |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
int _hash = 1; |
| 175 |
_hash = 31 * _hash + Objects.hashCode(mResourceDirs); |
| 176 |
_hash = 31 * _hash + Objects.hashCode(mOverlayPaths); |
| 177 |
return _hash; |
| 178 |
} |
| 179 |
|
| 180 |
@DataClass.Generated( |
| 181 |
time = 1612307813586L, |
| 182 |
codegenVersion = "1.0.22", |
| 183 |
sourceFile = "frameworks/base/core/java/android/content/pm/overlay/OverlayPaths.java", |
| 184 |
inputSignatures = "private final @android.annotation.NonNull java.util.List<java.lang.String> mResourceDirs\nprivate final @android.annotation.NonNull java.util.List<java.lang.String> mOverlayPaths\npublic boolean isEmpty()\nclass OverlayPaths extends java.lang.Object implements []\nfinal android.content.pm.overlay.OverlayPaths mPaths\npublic android.content.pm.overlay.OverlayPaths.Builder addNonApkPath(java.lang.String)\npublic android.content.pm.overlay.OverlayPaths.Builder addApkPath(java.lang.String)\npublic android.content.pm.overlay.OverlayPaths.Builder addAll(android.content.pm.overlay.OverlayPaths)\npublic android.content.pm.overlay.OverlayPaths build()\nprivate static void addUniquePath(java.util.List<java.lang.String>,java.lang.String)\nclass Builder extends java.lang.Object implements []\n@com.android.internal.util.DataClass(genConstructor=false, genBuilder=false, genHiddenBuilder=false, genEqualsHashCode=true, genToString=true)") |
| 185 |
@Deprecated |
| 186 |
private void __metadata() {} |
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
} |