Fix lint error for those module used in mainline module
Bug: 187861723 Test: rebuild Change-Id: I3a8c9e00f164d0f0dd381b188ecfd0c4a758a277 Merged-In: I3a8c9e00f164d0f0dd381b188ecfd0c4a758a277
This commit is contained in:
@@ -19,5 +19,5 @@ android_library {
|
|||||||
],
|
],
|
||||||
|
|
||||||
sdk_version: "system_current",
|
sdk_version: "system_current",
|
||||||
min_sdk_version: "21",
|
min_sdk_version: "28",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Call requires API level 23 (current min is 21): `android.view.View#setOnScrollChangeListener`"
|
|
||||||
errorLine1=" mScrollView.setOnScrollChangeListener(mScrollChangeWatcher);"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/ActionBarShadow/src/com/android/settingslib/widget/ActionBarShadowController.java"
|
|
||||||
line="81"
|
|
||||||
column="25"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Call requires API level 23 (current min is 21): `android.view.View#setOnScrollChangeListener`"
|
|
||||||
errorLine1=" mScrollView.setOnScrollChangeListener(null);"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/ActionBarShadow/src/com/android/settingslib/widget/ActionBarShadowController.java"
|
|
||||||
line="88"
|
|
||||||
column="21"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Class requires API level 23 (current min is 21): `android.view.View.OnScrollChangeListener`"
|
|
||||||
errorLine1=" final class ScrollChangeWatcher implements View.OnScrollChangeListener {"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/ActionBarShadow/src/com/android/settingslib/widget/ActionBarShadowController.java"
|
|
||||||
line="95"
|
|
||||||
column="48"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
</issues>
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="`android:Widget.DeviceDefault.Button.Borderless.Colored` requires API level 28 (current min is 21)"
|
|
||||||
errorLine1=" <style name="SettingsActionButton" parent="android:Widget.DeviceDefault.Button.Borderless.Colored">"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/ActionButtonsPreference/res/values/styles.xml"
|
|
||||||
line="19"
|
|
||||||
column="40"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="`android:drawableTint` requires API level 23 (current min is 21)"
|
|
||||||
errorLine1=" <item name="android:drawableTint">@*android:color/btn_colored_borderless_text_material</item>"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/ActionButtonsPreference/res/values/styles.xml"
|
|
||||||
line="21"
|
|
||||||
column="15"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="`?android:attr/dialogCornerRadius` requires API level 28 (current min is 21)"
|
|
||||||
errorLine1=" android:topLeftRadius="?android:attr/dialogCornerRadius""
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/ActionButtonsPreference/res/drawable/half_rounded_left_bk.xml"
|
|
||||||
line="23"
|
|
||||||
column="9"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="`?android:attr/dialogCornerRadius` requires API level 28 (current min is 21)"
|
|
||||||
errorLine1=" android:bottomLeftRadius="?android:attr/dialogCornerRadius""
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/ActionButtonsPreference/res/drawable/half_rounded_left_bk.xml"
|
|
||||||
line="25"
|
|
||||||
column="9"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="`?android:attr/dialogCornerRadius` requires API level 28 (current min is 21)"
|
|
||||||
errorLine1=" android:topRightRadius="?android:attr/dialogCornerRadius""
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/ActionButtonsPreference/res/drawable/half_rounded_right_bk.xml"
|
|
||||||
line="24"
|
|
||||||
column="9"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="`?android:attr/dialogCornerRadius` requires API level 28 (current min is 21)"
|
|
||||||
errorLine1=" android:bottomRightRadius="?android:attr/dialogCornerRadius""
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/ActionButtonsPreference/res/drawable/half_rounded_right_bk.xml"
|
|
||||||
line="26"
|
|
||||||
column="9"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="`?android:attr/dialogCornerRadius` requires API level 28 (current min is 21)"
|
|
||||||
errorLine1=" android:bottomRightRadius="?android:attr/dialogCornerRadius""
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/ActionButtonsPreference/res/drawable/rounded_bk.xml"
|
|
||||||
line="23"
|
|
||||||
column="9"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
</issues>
|
|
||||||
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:targetApi="28"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<solid android:color="?androidprv:attr/colorSurface" />
|
<solid android:color="?androidprv:attr/colorSurface" />
|
||||||
<corners
|
<corners
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright (C) 2021 The Android Open Source Project
|
Copyright (C) 2021 The Android Open Source Project
|
||||||
~
|
|
||||||
~ 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.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:targetApi="28"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<solid android:color="?androidprv:attr/colorSurface" />
|
<solid android:color="?androidprv:attr/colorSurface" />
|
||||||
<corners
|
<corners
|
||||||
|
|||||||
@@ -1,22 +1,24 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright (C) 2021 The Android Open Source Project
|
Copyright (C) 2021 The Android Open Source Project
|
||||||
~
|
|
||||||
~ 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.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:targetApi="28"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<solid android:color="?androidprv:attr/colorSurface" />
|
<solid android:color="?androidprv:attr/colorSurface" />
|
||||||
<corners
|
<corners
|
||||||
|
|||||||
@@ -15,7 +15,9 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<resources>
|
<resources
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:targetApi="28">
|
||||||
<style name="SettingsLibActionButton" parent="android:Widget.DeviceDefault.Button.Borderless.Colored">
|
<style name="SettingsLibActionButton" parent="android:Widget.DeviceDefault.Button.Borderless.Colored">
|
||||||
<item name="android:drawablePadding">4dp</item>
|
<item name="android:drawablePadding">4dp</item>
|
||||||
<item name="android:drawableTint">@*android:color/btn_colored_borderless_text_material</item>
|
<item name="android:drawableTint">@*android:color/btn_colored_borderless_text_material</item>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ android_library {
|
|||||||
resource_dirs: ["res"],
|
resource_dirs: ["res"],
|
||||||
|
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"androidx.preference_preference",
|
"androidx.preference_preference",
|
||||||
],
|
],
|
||||||
|
|
||||||
sdk_version: "system_current",
|
sdk_version: "system_current",
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="`@android:style/Widget.DeviceDefault.Button.Borderless.Colored` requires API level 28 (current min is 21)"
|
|
||||||
errorLine1=" parent="@android:style/Widget.DeviceDefault.Button.Borderless.Colored">"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/BarChartPreference/res/values/styles.xml"
|
|
||||||
line="35"
|
|
||||||
column="12"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
</issues>
|
|
||||||
@@ -15,7 +15,9 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<resources>
|
<resources
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:targetApi="28">
|
||||||
|
|
||||||
<style name="SettingsBarChart">
|
<style name="SettingsBarChart">
|
||||||
<item name="android:layout_marginStart">10dp</item>
|
<item name="android:layout_marginStart">10dp</item>
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Call requires API level 28 (current min is 21): `android.content.pm.PackageInfo#getLongVersionCode`"
|
|
||||||
errorLine1=" sCachedVersionCode = Long.toString(info.getLongVersionCode());"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/HelpUtils/src/com/android/settingslib/HelpUtils.java"
|
|
||||||
line="239"
|
|
||||||
column="57"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
</issues>
|
|
||||||
@@ -25,6 +25,7 @@ import android.content.pm.PackageInfo;
|
|||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.provider.Settings.Global;
|
import android.provider.Settings.Global;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -32,6 +33,7 @@ import android.view.Menu;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MenuItem.OnMenuItemClickListener;
|
import android.view.MenuItem.OnMenuItemClickListener;
|
||||||
|
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
import com.android.settingslib.widget.R;
|
import com.android.settingslib.widget.R;
|
||||||
@@ -73,6 +75,15 @@ public class HelpUtils {
|
|||||||
private HelpUtils() {
|
private HelpUtils() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares the help menu item by doing the following.
|
||||||
|
* - If the helpUrlString is empty or null, the help menu item is made invisible.
|
||||||
|
* - Otherwise, this makes the help menu item visible and sets the intent for the help menu
|
||||||
|
* item to view the URL.
|
||||||
|
*
|
||||||
|
* @return returns whether the help menu item has been made visible.
|
||||||
|
*/
|
||||||
|
@RequiresApi(Build.VERSION_CODES.P)
|
||||||
public static boolean prepareHelpMenuItem(Activity activity, Menu menu, String helpUri,
|
public static boolean prepareHelpMenuItem(Activity activity, Menu menu, String helpUri,
|
||||||
String backupContext) {
|
String backupContext) {
|
||||||
// menu contains help item, skip it
|
// menu contains help item, skip it
|
||||||
@@ -84,6 +95,15 @@ public class HelpUtils {
|
|||||||
return prepareHelpMenuItem(activity, helpItem, helpUri, backupContext);
|
return prepareHelpMenuItem(activity, helpItem, helpUri, backupContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepares the help menu item by doing the following.
|
||||||
|
* - If the helpUrlString is empty or null, the help menu item is made invisible.
|
||||||
|
* - Otherwise, this makes the help menu item visible and sets the intent for the help menu
|
||||||
|
* item to view the URL.
|
||||||
|
*
|
||||||
|
* @return returns whether the help menu item has been made visible.
|
||||||
|
*/
|
||||||
|
@RequiresApi(Build.VERSION_CODES.P)
|
||||||
public static boolean prepareHelpMenuItem(Activity activity, Menu menu, int helpUriResource,
|
public static boolean prepareHelpMenuItem(Activity activity, Menu menu, int helpUriResource,
|
||||||
String backupContext) {
|
String backupContext) {
|
||||||
// menu contains help item, skip it
|
// menu contains help item, skip it
|
||||||
@@ -105,6 +125,7 @@ public class HelpUtils {
|
|||||||
* @return returns whether the help menu item has been made visible.
|
* @return returns whether the help menu item has been made visible.
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@RequiresApi(Build.VERSION_CODES.P)
|
||||||
static boolean prepareHelpMenuItem(final Activity activity, MenuItem helpMenuItem,
|
static boolean prepareHelpMenuItem(final Activity activity, MenuItem helpMenuItem,
|
||||||
String helpUriString, String backupContext) {
|
String helpUriString, String backupContext) {
|
||||||
if (Global.getInt(activity.getContentResolver(), Global.DEVICE_PROVISIONED, 0) == 0) {
|
if (Global.getInt(activity.getContentResolver(), Global.DEVICE_PROVISIONED, 0) == 0) {
|
||||||
@@ -152,6 +173,10 @@ public class HelpUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the help intent from helpUriString.
|
||||||
|
*/
|
||||||
|
@RequiresApi(Build.VERSION_CODES.P)
|
||||||
public static Intent getHelpIntent(Context context, String helpUriString,
|
public static Intent getHelpIntent(Context context, String helpUriString,
|
||||||
String backupContext) {
|
String backupContext) {
|
||||||
if (Global.getInt(context.getContentResolver(), Global.DEVICE_PROVISIONED, 0) == 0) {
|
if (Global.getInt(context.getContentResolver(), Global.DEVICE_PROVISIONED, 0) == 0) {
|
||||||
@@ -223,7 +248,8 @@ public class HelpUtils {
|
|||||||
*
|
*
|
||||||
* @return the uri with added query parameters
|
* @return the uri with added query parameters
|
||||||
*/
|
*/
|
||||||
private static Uri uriWithAddedParameters(Context context, Uri baseUri) {
|
@RequiresApi(Build.VERSION_CODES.P)
|
||||||
|
public static Uri uriWithAddedParameters(Context context, Uri baseUri) {
|
||||||
Uri.Builder builder = baseUri.buildUpon();
|
Uri.Builder builder = baseUri.buildUpon();
|
||||||
|
|
||||||
// Add in the preferred language
|
// Add in the preferred language
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="`?android:attr/colorSecondary` requires API level 25 (current min is 21)"
|
|
||||||
errorLine1=" android:background="?android:attr/colorSecondary" />"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/ProgressBar/res/layout/progress_header.xml"
|
|
||||||
line="27"
|
|
||||||
column="9"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
</issues>
|
|
||||||
@@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:targetApi="25"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="3dp">
|
android:layout_height="3dp">
|
||||||
<View
|
<View
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Call requires API level 23 (current min is 21): `android.content.Context#getSystemService`"
|
|
||||||
errorLine1=" ComponentName adminComponent = userContext.getSystemService("
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/RestrictedLockUtils/src/com/android/settingslib/RestrictedLockUtils.java"
|
|
||||||
line="59"
|
|
||||||
column="52"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Call requires API level 23 (current min is 21): `android.content.Context#getSystemService`"
|
|
||||||
errorLine1=" UserManager um = context.getSystemService(UserManager.class);"
|
|
||||||
errorLine2=" ~~~~~~~~~~~~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/RestrictedLockUtils/src/com/android/settingslib/RestrictedLockUtils.java"
|
|
||||||
line="101"
|
|
||||||
column="34"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
</issues>
|
|
||||||
@@ -21,11 +21,13 @@ import android.content.ComponentName;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -34,10 +36,18 @@ import java.util.Objects;
|
|||||||
* support message dialog.
|
* support message dialog.
|
||||||
*/
|
*/
|
||||||
public class RestrictedLockUtils {
|
public class RestrictedLockUtils {
|
||||||
|
/**
|
||||||
|
* Get EnforcedAdmin from DevicePolicyManager
|
||||||
|
*/
|
||||||
|
@RequiresApi(Build.VERSION_CODES.M)
|
||||||
public static EnforcedAdmin getProfileOrDeviceOwner(Context context, UserHandle user) {
|
public static EnforcedAdmin getProfileOrDeviceOwner(Context context, UserHandle user) {
|
||||||
return getProfileOrDeviceOwner(context, null, user);
|
return getProfileOrDeviceOwner(context, null, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get EnforcedAdmin from DevicePolicyManager
|
||||||
|
*/
|
||||||
|
@RequiresApi(Build.VERSION_CODES.M)
|
||||||
public static EnforcedAdmin getProfileOrDeviceOwner(
|
public static EnforcedAdmin getProfileOrDeviceOwner(
|
||||||
Context context, String enforcedRestriction, UserHandle user) {
|
Context context, String enforcedRestriction, UserHandle user) {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
@@ -73,6 +83,7 @@ public class RestrictedLockUtils {
|
|||||||
/**
|
/**
|
||||||
* Send the intent to trigger the {@code android.settings.ShowAdminSupportDetailsDialog}.
|
* Send the intent to trigger the {@code android.settings.ShowAdminSupportDetailsDialog}.
|
||||||
*/
|
*/
|
||||||
|
@RequiresApi(Build.VERSION_CODES.M)
|
||||||
public static void sendShowAdminSupportDetailsIntent(Context context, EnforcedAdmin admin) {
|
public static void sendShowAdminSupportDetailsIntent(Context context, EnforcedAdmin admin) {
|
||||||
final Intent intent = getShowAdminSupportDetailsIntent(context, admin);
|
final Intent intent = getShowAdminSupportDetailsIntent(context, admin);
|
||||||
int targetUserId = UserHandle.myUserId();
|
int targetUserId = UserHandle.myUserId();
|
||||||
@@ -97,6 +108,10 @@ public class RestrictedLockUtils {
|
|||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if current user is profile or not
|
||||||
|
*/
|
||||||
|
@RequiresApi(Build.VERSION_CODES.M)
|
||||||
public static boolean isCurrentUserOrProfile(Context context, int userId) {
|
public static boolean isCurrentUserOrProfile(Context context, int userId) {
|
||||||
UserManager um = context.getSystemService(UserManager.class);
|
UserManager um = context.getSystemService(UserManager.class);
|
||||||
return um.getUserProfiles().contains(UserHandle.of(userId));
|
return um.getUserProfiles().contains(UserHandle.of(userId));
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<issues format="5" by="lint 4.1.0" client="cli" variant="all" version="4.1.0">
|
|
||||||
|
|
||||||
<issue
|
|
||||||
id="NewApi"
|
|
||||||
message="Call requires API level 23 (current min is 21): `new android.widget.Spinner`"
|
|
||||||
errorLine1=" super(context, attrs, defStyleAttr, defStyleRes, mode, null);"
|
|
||||||
errorLine2=" ~~~~~">
|
|
||||||
<location
|
|
||||||
file="frameworks/base/packages/SettingsLib/SettingsSpinner/src/com/android/settingslib/widget/settingsspinner/SettingsSpinner.java"
|
|
||||||
line="122"
|
|
||||||
column="9"/>
|
|
||||||
</issue>
|
|
||||||
|
|
||||||
</issues>
|
|
||||||
@@ -17,9 +17,12 @@
|
|||||||
package com.android.settingslib.widget.settingsspinner;
|
package com.android.settingslib.widget.settingsspinner;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
|
||||||
import com.android.settingslib.widget.R;
|
import com.android.settingslib.widget.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -117,6 +120,7 @@ public class SettingsSpinner extends Spinner {
|
|||||||
* @see Spinner#MODE_DIALOG
|
* @see Spinner#MODE_DIALOG
|
||||||
* @see Spinner#MODE_DROPDOWN
|
* @see Spinner#MODE_DROPDOWN
|
||||||
*/
|
*/
|
||||||
|
@RequiresApi(Build.VERSION_CODES.M)
|
||||||
public SettingsSpinner(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes,
|
public SettingsSpinner(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes,
|
||||||
int mode) {
|
int mode) {
|
||||||
super(context, attrs, defStyleAttr, defStyleRes, mode, null);
|
super(context, attrs, defStyleAttr, defStyleRes, mode, null);
|
||||||
|
|||||||
Reference in New Issue
Block a user