1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.networkstack.apishim.api31; 18 19 import androidx.annotation.VisibleForTesting; 20 21 /** 22 * Utility class for defining and importing constants from the Android platform. 23 */ 24 public class ConstantsShim extends com.android.networkstack.apishim.api30.ConstantsShim { 25 /** 26 * Constant that callers can use to determine what version of the shim they are using. 27 * Must be the same as the version of the shims. 28 * This should only be used by test code. Production code that uses the shims should be using 29 * the shimmed objects and methods themselves. 30 */ 31 @VisibleForTesting 32 public static final int VERSION = 31; 33 34 // When removing this shim, the version in NetworkMonitorUtils should be removed too. 35 // TODO: add TRANSPORT_TEST to system API in API 31 (it is only a test API as of R) 36 public static final int TRANSPORT_TEST = 7; 37 38 /** 39 * Flag for {@link #registerReceiver}: The receiver can receive broadcasts from other apps; 40 * has the same behavior as marking a statically registered receiver with "exported=true". 41 */ 42 public static final int RECEIVER_EXPORTED = 0x2; 43 44 /** 45 * Flag for {@link android.content.Context#registerReceiver}: The receiver cannot receive 46 * broadcasts from other apps; has the same behavior as marking a statically registered receiver 47 * with "exported=false". 48 */ 49 public static final int RECEIVER_NOT_EXPORTED = 0x4; 50 } 51