error on NewApi/InlinedApi to catch compat issues with old devices

This commit is contained in:
Hans-Christoph Steiner 2018-08-10 11:23:20 +02:00
parent 897a35aa76
commit 2f038d81e0
2 changed files with 26 additions and 23 deletions

View File

@ -9,6 +9,8 @@
<issue id="ImpliedQuantity" severity="error"/> <issue id="ImpliedQuantity" severity="error"/>
<issue id="DefaultLocale" severity="error"/> <issue id="DefaultLocale" severity="error"/>
<issue id="NewApi" severity="error"/>
<issue id="InlinedApi" severity="error"/>
<!-- These are important to us, so promote from warning to error --> <!-- These are important to us, so promote from warning to error -->
<issue id="UnusedResources" severity="error"> <issue id="UnusedResources" severity="error">

View File

@ -1,20 +1,20 @@
/* /*
** **
** Copyright 2007, The Android Open Source Project ** Copyright 2007, The Android Open Source Project
** Copyright 2015 Daniel Martí <mvdan@mvdan.cc> ** Copyright 2015 Daniel Martí <mvdan@mvdan.cc>
** **
** Licensed under the Apache License, Version 2.0 (the "License"); ** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License. ** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at ** 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 ** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS, ** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and ** See the License for the specific language governing permissions and
** limitations under the License. ** limitations under the License.
*/ */
package org.fdroid.fdroid.privileged.views; package org.fdroid.fdroid.privileged.views;
@ -65,17 +65,17 @@ import java.util.Set;
* extended information consisting of all groups and permissions. * extended information consisting of all groups and permissions.
* To use this view define a LinearLayout or any ViewGroup and add this * To use this view define a LinearLayout or any ViewGroup and add this
* view by instantiating AppSecurityPermissions and invoking getPermissionsView. * view by instantiating AppSecurityPermissions and invoking getPermissionsView.
* <p/> * <p>
* NOTES: * NOTES:
* Based on AOSP core/java/android/widget/AppSecurityPermissions.java * Based on AOSP {@code core/java/android/widget/AppSecurityPermissions.java},
* latest included commit: a3f68ef2f6811cf72f1282214c0883db5a30901d * latest included commit: a3f68ef2f6811cf72f1282214c0883db5a30901d,
* Reviewed against frameworks/base/core/java/android/widget/AppSecurityPermissions.java * Reviewed against {@code frameworks/base/core/java/android/widget/AppSecurityPermissions.java},
* from commit {@code android-8.1.0_r2} * from commit {@code android-8.1.0_r2}
* <p/> * <p>
* To update this file, Start from latest included commit and include changes * To update this file, Start from latest included commit and include changes
* until the newest commit with care: * until the newest commit with care:
* github.com/android/platform_frameworks_base/blob/master/core/java/android/widget/AppSecurityPermissions.java * <a href="http://github.com/android/platform_frameworks_base/blob/master/core/java/android/widget/AppSecurityPermissions">android/widget/AppSecurityPermissions.java</a>
* <p/> * <p>
* This file has a different code style than the rest of fdroidclient because * This file has a different code style than the rest of fdroidclient because
* it is kept in sync with the file from AOSP. Please maintain the original * it is kept in sync with the file from AOSP. Please maintain the original
* AOSP code style so it is easy to track changes. * AOSP code style so it is easy to track changes.
@ -426,6 +426,7 @@ public class AppSecurityPermissions {
return permView; return permView;
} }
@TargetApi(23)
private boolean isDisplayablePermission(PermissionInfo pInfo, int existingReqFlags) { private boolean isDisplayablePermission(PermissionInfo pInfo, int existingReqFlags) {
final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE; final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE;
final boolean isNormal = base == PermissionInfo.PROTECTION_NORMAL; final boolean isNormal = base == PermissionInfo.PROTECTION_NORMAL;