OMS: fix checkstyle warnings
Fix checkstyle warnings related to the overlay manager, i.e. in the Java files under - core/java/android/content/om - core/tests/overlaytests - services/core/java/com/android/server/om Test: prebuilts/checkstyle/checkstyle.py -f $path Change-Id: I5078629240da2ceb1fd710d2e79e3114bafdd5bb
This commit is contained in:
committed by
Todd Kennedy
parent
2ffad2ba3a
commit
3898834574
@@ -278,13 +278,12 @@ public abstract class OverlayBaseTest {
|
||||
}
|
||||
}
|
||||
|
||||
final String no = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, " +
|
||||
"sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " +
|
||||
"Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip " +
|
||||
"ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit " +
|
||||
"esse cillum dolore eu fugiat nulla pariatur. " +
|
||||
"Excepteur sint occaecat cupidatat non proident, " +
|
||||
"sunt in culpa qui officia deserunt mollit anim id est laborum.";
|
||||
final String no = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do "
|
||||
+ "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim "
|
||||
+ "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo "
|
||||
+ "consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse "
|
||||
+ "cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non "
|
||||
+ "proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
|
||||
final String so = "Lorem ipsum: single overlay.";
|
||||
final String mo = "Lorem ipsum: multiple overlays.";
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.server.om.hosttest;
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2018 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy
|
||||
* of the License at
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.server.om.hosttest.update_overlay_test;
|
||||
|
||||
|
||||
@@ -223,8 +223,8 @@ public final class OverlayManagerService extends SystemService {
|
||||
public OverlayManagerService(@NonNull final Context context,
|
||||
@NonNull final Installer installer) {
|
||||
super(context);
|
||||
mSettingsFile =
|
||||
new AtomicFile(new File(Environment.getDataSystemDirectory(), "overlays.xml"), "overlays");
|
||||
mSettingsFile = new AtomicFile(
|
||||
new File(Environment.getDataSystemDirectory(), "overlays.xml"), "overlays");
|
||||
mPackageManager = new PackageManagerHelper();
|
||||
mUserManager = UserManagerService.getInstance();
|
||||
IdmapManager im = new IdmapManager(installer);
|
||||
@@ -717,9 +717,9 @@ public final class OverlayManagerService extends SystemService {
|
||||
final Map<String, List<String>> pendingChanges = new ArrayMap<>(targetPackageNames.size());
|
||||
synchronized (mLock) {
|
||||
final List<String> frameworkOverlays =
|
||||
mImpl.getEnabledOverlayPackageNames("android", userId);
|
||||
final int N = targetPackageNames.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
mImpl.getEnabledOverlayPackageNames("android", userId);
|
||||
final int n = targetPackageNames.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final String targetPackageName = targetPackageNames.get(i);
|
||||
List<String> list = new ArrayList<>();
|
||||
if (!"android".equals(targetPackageName)) {
|
||||
@@ -730,8 +730,8 @@ public final class OverlayManagerService extends SystemService {
|
||||
}
|
||||
}
|
||||
|
||||
final int N = targetPackageNames.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final int n = targetPackageNames.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final String targetPackageName = targetPackageNames.get(i);
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "-> Updating overlay: target=" + targetPackageName + " overlays=["
|
||||
@@ -789,7 +789,7 @@ public final class OverlayManagerService extends SystemService {
|
||||
if (!mSettingsFile.getBaseFile().exists()) {
|
||||
return;
|
||||
}
|
||||
try (final FileInputStream stream = mSettingsFile.openRead()) {
|
||||
try (FileInputStream stream = mSettingsFile.openRead()) {
|
||||
mSettings.restore(stream);
|
||||
|
||||
// We might have data for dying users if the device was
|
||||
@@ -915,8 +915,8 @@ public final class OverlayManagerService extends SystemService {
|
||||
|
||||
if (!verbose) {
|
||||
int count = 0;
|
||||
final int N = mCache.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final int n = mCache.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final int userId = mCache.keyAt(i);
|
||||
count += mCache.get(userId).size();
|
||||
}
|
||||
@@ -929,8 +929,8 @@ public final class OverlayManagerService extends SystemService {
|
||||
return;
|
||||
}
|
||||
|
||||
final int N = mCache.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final int n = mCache.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final int userId = mCache.keyAt(i);
|
||||
pw.println(TAB1 + "User " + userId);
|
||||
final HashMap<String, PackageInfo> map = mCache.get(userId);
|
||||
|
||||
@@ -55,8 +55,8 @@ import java.util.Set;
|
||||
*/
|
||||
final class OverlayManagerServiceImpl {
|
||||
// Flags to use in conjunction with updateState.
|
||||
private static final int FLAG_TARGET_IS_UPGRADING = 1<<0;
|
||||
private static final int FLAG_OVERLAY_IS_UPGRADING = 1<<1;
|
||||
private static final int FLAG_TARGET_IS_UPGRADING = 1 << 0;
|
||||
private static final int FLAG_OVERLAY_IS_UPGRADING = 1 << 1;
|
||||
|
||||
private final PackageManagerHelper mPackageManager;
|
||||
private final IdmapManager mIdmapManager;
|
||||
@@ -89,8 +89,8 @@ final class OverlayManagerServiceImpl {
|
||||
// a change in priority is only relevant for static RROs: specifically,
|
||||
// a regular RRO should not have its state reset only because a change
|
||||
// in priority
|
||||
if (theTruth.isStaticOverlayPackage() &&
|
||||
theTruth.overlayPriority != oldSettings.priority) {
|
||||
if (theTruth.isStaticOverlayPackage()
|
||||
&& theTruth.overlayPriority != oldSettings.priority) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -294,8 +294,8 @@ final class OverlayManagerServiceImpl {
|
||||
final int userId, final int flags) {
|
||||
boolean modified = false;
|
||||
final List<OverlayInfo> ois = mSettings.getOverlaysForTarget(targetPackageName, userId);
|
||||
final int N = ois.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final int n = ois.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final OverlayInfo oi = ois.get(i);
|
||||
final PackageInfo overlayPackage = mPackageManager.getPackageInfo(oi.packageName,
|
||||
userId);
|
||||
@@ -610,8 +610,8 @@ final class OverlayManagerServiceImpl {
|
||||
final List<OverlayInfo> overlays = mSettings.getOverlaysForTarget(targetPackageName,
|
||||
userId);
|
||||
final List<String> paths = new ArrayList<>(overlays.size());
|
||||
final int N = overlays.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final int n = overlays.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final OverlayInfo oi = overlays.get(i);
|
||||
if (oi.isEnabled()) {
|
||||
paths.add(oi.packageName);
|
||||
@@ -632,8 +632,8 @@ final class OverlayManagerServiceImpl {
|
||||
userId);
|
||||
|
||||
// Static RROs targeting to "android", ie framework-res.apk, are handled by native layers.
|
||||
if (targetPackage != null && overlayPackage != null &&
|
||||
!("android".equals(targetPackageName)
|
||||
if (targetPackage != null && overlayPackage != null
|
||||
&& !("android".equals(targetPackageName)
|
||||
&& overlayPackage.isStaticOverlayPackage())) {
|
||||
mIdmapManager.createIdmap(targetPackage, overlayPackage, userId);
|
||||
}
|
||||
@@ -663,7 +663,7 @@ final class OverlayManagerServiceImpl {
|
||||
|
||||
private @OverlayInfo.State int calculateNewState(@Nullable final PackageInfo targetPackage,
|
||||
@Nullable final PackageInfo overlayPackage, final int userId, final int flags)
|
||||
throws OverlayManagerSettings.BadKeyException {
|
||||
throws OverlayManagerSettings.BadKeyException {
|
||||
|
||||
if ((flags & FLAG_TARGET_IS_UPGRADING) != 0) {
|
||||
return STATE_TARGET_UPGRADING;
|
||||
|
||||
@@ -290,21 +290,22 @@ final class OverlayManagerSettings {
|
||||
return;
|
||||
}
|
||||
|
||||
final int N = mItems.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final int n = mItems.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final SettingsItem item = mItems.get(i);
|
||||
pw.println(item.mPackageName + ":" + item.getUserId() + " {");
|
||||
pw.increaseIndent();
|
||||
|
||||
pw.print("mPackageName.......: "); pw.println(item.mPackageName);
|
||||
pw.print("mUserId............: "); pw.println(item.getUserId());
|
||||
pw.print("mTargetPackageName.: "); pw.println(item.getTargetPackageName());
|
||||
pw.print("mBaseCodePath......: "); pw.println(item.getBaseCodePath());
|
||||
pw.print("mState.............: "); pw.println(OverlayInfo.stateToString(item.getState()));
|
||||
pw.print("mIsEnabled.........: "); pw.println(item.isEnabled());
|
||||
pw.print("mIsStatic..........: "); pw.println(item.isStatic());
|
||||
pw.print("mPriority..........: "); pw.println(item.mPriority);
|
||||
pw.print("mCategory..........: "); pw.println(item.mCategory);
|
||||
pw.println("mPackageName.......: " + item.mPackageName);
|
||||
pw.println("mUserId............: " + item.getUserId());
|
||||
pw.println("mTargetPackageName.: " + item.getTargetPackageName());
|
||||
pw.println("mBaseCodePath......: " + item.getBaseCodePath());
|
||||
pw.println("mState.............: " + OverlayInfo.stateToString(item.getState()));
|
||||
pw.println("mState.............: " + OverlayInfo.stateToString(item.getState()));
|
||||
pw.println("mIsEnabled.........: " + item.isEnabled());
|
||||
pw.println("mIsStatic..........: " + item.isStatic());
|
||||
pw.println("mPriority..........: " + item.mPriority);
|
||||
pw.println("mCategory..........: " + item.mCategory);
|
||||
|
||||
pw.decreaseIndent();
|
||||
pw.println("}");
|
||||
@@ -400,8 +401,8 @@ final class OverlayManagerSettings {
|
||||
xml.startTag(null, TAG_OVERLAYS);
|
||||
XmlUtils.writeIntAttribute(xml, ATTR_VERSION, CURRENT_VERSION);
|
||||
|
||||
final int N = table.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final int n = table.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final SettingsItem item = table.get(i);
|
||||
persistRow(xml, item);
|
||||
}
|
||||
@@ -542,8 +543,8 @@ final class OverlayManagerSettings {
|
||||
}
|
||||
|
||||
private int select(@NonNull final String packageName, final int userId) {
|
||||
final int N = mItems.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final int n = mItems.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final SettingsItem item = mItems.get(i);
|
||||
if (item.mUserId == userId && item.mPackageName.equals(packageName)) {
|
||||
return i;
|
||||
|
||||
@@ -121,8 +121,8 @@ final class OverlayManagerShellCommand extends ShellCommand {
|
||||
for (final String targetPackageName : allOverlays.keySet()) {
|
||||
out.println(targetPackageName);
|
||||
List<OverlayInfo> overlaysForTarget = allOverlays.get(targetPackageName);
|
||||
final int N = overlaysForTarget.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final int n = overlaysForTarget.size();
|
||||
for (int i = 0; i < n; i++) {
|
||||
final OverlayInfo oi = overlaysForTarget.get(i);
|
||||
String status;
|
||||
switch (oi.state) {
|
||||
|
||||
Reference in New Issue
Block a user