Loading core/java/android/annotation/RequiresFeature.java 0 → 100644 +45 −0 Original line number Diff line number Diff line /* * 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 * * 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. */ package android.annotation; import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.content.pm.PackageManager; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * Denotes that the annotated element requires one or more device features. This * is used to auto-generate documentation. * * @see PackageManager#hasSystemFeature(String) * @hide */ @Retention(SOURCE) @Target({TYPE,FIELD,METHOD,CONSTRUCTOR}) public @interface RequiresFeature { /** * The name of the device feature that is required. * * @see PackageManager#hasSystemFeature(String) */ String value(); } core/java/android/annotation/SystemService.java +8 −1 Original line number Diff line number Diff line Loading @@ -26,12 +26,19 @@ import java.lang.annotation.Target; /** * Description of a system service available through * {@link Context#getSystemService(Class)}. * {@link Context#getSystemService(Class)}. This is used to auto-generate * documentation explaining how to obtain a reference to the service. * * @hide */ @Retention(SOURCE) @Target(TYPE) public @interface SystemService { /** * The string name of the system service that can be passed to * {@link Context#getSystemService(String)}. * * @see Context#getSystemServiceName(Class) */ String value(); } core/java/android/app/admin/DevicePolicyManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.ColorInt; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresFeature; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; Loading Loading @@ -116,6 +117,7 @@ import java.util.concurrent.Executor; * guide. </div> */ @SystemService(Context.DEVICE_POLICY_SERVICE) @RequiresFeature(PackageManager.FEATURE_DEVICE_ADMIN) public class DevicePolicyManager { private static String TAG = "DevicePolicyManager"; Loading core/java/android/appwidget/AppWidgetManager.java +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.appwidget; import android.annotation.BroadcastBehavior; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresFeature; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SystemService; Loading @@ -29,6 +30,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentSender; import android.content.ServiceConnection; import android.content.pm.PackageManager; import android.content.pm.ParceledListSlice; import android.content.pm.ShortcutInfo; import android.os.Bundle; Loading @@ -55,6 +57,7 @@ import java.util.List; * </div> */ @SystemService(Context.APPWIDGET_SERVICE) @RequiresFeature(PackageManager.FEATURE_APP_WIDGETS) public class AppWidgetManager { /** Loading core/java/android/bluetooth/BluetoothManager.java +3 −0 Original line number Diff line number Diff line Loading @@ -17,9 +17,11 @@ package android.bluetooth; import android.Manifest; import android.annotation.RequiresFeature; import android.annotation.RequiresPermission; import android.annotation.SystemService; import android.content.Context; import android.content.pm.PackageManager; import android.os.RemoteException; import android.util.Log; Loading Loading @@ -47,6 +49,7 @@ import java.util.List; * @see BluetoothAdapter#getDefaultAdapter() */ @SystemService(Context.BLUETOOTH_SERVICE) @RequiresFeature(PackageManager.FEATURE_BLUETOOTH) public final class BluetoothManager { private static final String TAG = "BluetoothManager"; private static final boolean DBG = true; Loading Loading
core/java/android/annotation/RequiresFeature.java 0 → 100644 +45 −0 Original line number Diff line number Diff line /* * 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 * * 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. */ package android.annotation; import static java.lang.annotation.ElementType.CONSTRUCTOR; import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.content.pm.PackageManager; import java.lang.annotation.Retention; import java.lang.annotation.Target; /** * Denotes that the annotated element requires one or more device features. This * is used to auto-generate documentation. * * @see PackageManager#hasSystemFeature(String) * @hide */ @Retention(SOURCE) @Target({TYPE,FIELD,METHOD,CONSTRUCTOR}) public @interface RequiresFeature { /** * The name of the device feature that is required. * * @see PackageManager#hasSystemFeature(String) */ String value(); }
core/java/android/annotation/SystemService.java +8 −1 Original line number Diff line number Diff line Loading @@ -26,12 +26,19 @@ import java.lang.annotation.Target; /** * Description of a system service available through * {@link Context#getSystemService(Class)}. * {@link Context#getSystemService(Class)}. This is used to auto-generate * documentation explaining how to obtain a reference to the service. * * @hide */ @Retention(SOURCE) @Target(TYPE) public @interface SystemService { /** * The string name of the system service that can be passed to * {@link Context#getSystemService(String)}. * * @see Context#getSystemServiceName(Class) */ String value(); }
core/java/android/app/admin/DevicePolicyManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.annotation.ColorInt; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresFeature; import android.annotation.RequiresPermission; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; Loading Loading @@ -116,6 +117,7 @@ import java.util.concurrent.Executor; * guide. </div> */ @SystemService(Context.DEVICE_POLICY_SERVICE) @RequiresFeature(PackageManager.FEATURE_DEVICE_ADMIN) public class DevicePolicyManager { private static String TAG = "DevicePolicyManager"; Loading
core/java/android/appwidget/AppWidgetManager.java +3 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package android.appwidget; import android.annotation.BroadcastBehavior; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresFeature; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SystemService; Loading @@ -29,6 +30,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentSender; import android.content.ServiceConnection; import android.content.pm.PackageManager; import android.content.pm.ParceledListSlice; import android.content.pm.ShortcutInfo; import android.os.Bundle; Loading @@ -55,6 +57,7 @@ import java.util.List; * </div> */ @SystemService(Context.APPWIDGET_SERVICE) @RequiresFeature(PackageManager.FEATURE_APP_WIDGETS) public class AppWidgetManager { /** Loading
core/java/android/bluetooth/BluetoothManager.java +3 −0 Original line number Diff line number Diff line Loading @@ -17,9 +17,11 @@ package android.bluetooth; import android.Manifest; import android.annotation.RequiresFeature; import android.annotation.RequiresPermission; import android.annotation.SystemService; import android.content.Context; import android.content.pm.PackageManager; import android.os.RemoteException; import android.util.Log; Loading Loading @@ -47,6 +49,7 @@ import java.util.List; * @see BluetoothAdapter#getDefaultAdapter() */ @SystemService(Context.BLUETOOTH_SERVICE) @RequiresFeature(PackageManager.FEATURE_BLUETOOTH) public final class BluetoothManager { private static final String TAG = "BluetoothManager"; private static final boolean DBG = true; Loading