Merge "Change tethering file structure to respect its package name" into rvc-dev-plus-aosp

This commit is contained in:
Mark Chien
2020-04-14 14:45:48 +00:00
committed by Android (Google) Code Review
28 changed files with 41 additions and 48 deletions

View File

@@ -43,7 +43,7 @@
android:process="com.android.networkstack.process" android:process="com.android.networkstack.process"
android:extractNativeLibs="false" android:extractNativeLibs="false"
android:persistent="true"> android:persistent="true">
<service android:name="com.android.server.connectivity.tethering.TetheringService" <service android:name="com.android.networkstack.tethering.TetheringService"
android:permission="android.permission.MAINLINE_NETWORK_STACK" android:permission="android.permission.MAINLINE_NETWORK_STACK"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>

View File

@@ -22,7 +22,7 @@
android:process="system"> android:process="system">
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29" /> <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29" />
<application> <application>
<service android:name="com.android.server.connectivity.tethering.TetheringService" <service android:name="com.android.networkstack.tethering.TetheringService"
android:process="system" android:process="system"
android:permission="android.permission.MAINLINE_NETWORK_STACK" android:permission="android.permission.MAINLINE_NETWORK_STACK"
android:exported="true"> android:exported="true">

View File

@@ -1,5 +1,5 @@
# Keep class's integer static field for MessageUtils to parsing their name. # Keep class's integer static field for MessageUtils to parsing their name.
-keep class com.android.server.connectivity.tethering.Tethering$TetherMasterSM { -keep class com.android.networkstack.tethering.Tethering$TetherMasterSM {
static final int CMD_*; static final int CMD_*;
static final int EVENT_*; static final int EVENT_*;
} }

View File

@@ -89,7 +89,7 @@
TYPE_MOBILE_HIPRI is appended. TYPE_MOBILE_HIPRI is appended.
For other changes applied to this list, now and in the future, see For other changes applied to this list, now and in the future, see
com.android.server.connectivity.tethering.TetheringConfiguration. com.android.networkstack.tethering.TetheringConfiguration.
Note also: the order of this is important. The first upstream type Note also: the order of this is important. The first upstream type
for which a satisfying network exists is used. for which a satisfying network exists is used.

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.net.TetheringManager.TETHERING_WIFI; import static android.net.TetheringManager.TETHERING_WIFI;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.net.TetheringConstants.EXTRA_ADD_TETHER_TYPE; import static android.net.TetheringConstants.EXTRA_ADD_TETHER_TYPE;
import static android.net.TetheringConstants.EXTRA_PROVISION_CALLBACK; import static android.net.TetheringConstants.EXTRA_PROVISION_CALLBACK;
@@ -52,7 +52,6 @@ import android.util.SparseIntArray;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.StateMachine; import com.android.internal.util.StateMachine;
import com.android.networkstack.tethering.R;
import java.io.PrintWriter; import java.io.PrintWriter;
@@ -71,7 +70,7 @@ public class EntitlementManager {
@VisibleForTesting @VisibleForTesting
protected static final String DISABLE_PROVISIONING_SYSPROP_KEY = "net.tethering.noprovisioning"; protected static final String DISABLE_PROVISIONING_SYSPROP_KEY = "net.tethering.noprovisioning";
private static final String ACTION_PROVISIONING_ALARM = private static final String ACTION_PROVISIONING_ALARM =
"com.android.server.connectivity.tethering.PROVISIONING_RECHECK_ALARM"; "com.android.networkstack.tethering.PROVISIONING_RECHECK_ALARM";
private static final String EXTRA_SUBID = "subId"; private static final String EXTRA_SUBID = "subId";
private final ComponentName mSilentProvisioningService; private final ComponentName mSilentProvisioningService;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import android.net.IpPrefix; import android.net.IpPrefix;
import android.net.LinkAddress; import android.net.LinkAddress;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.net.NetworkStats.DEFAULT_NETWORK_NO; import static android.net.NetworkStats.DEFAULT_NETWORK_NO;
import static android.net.NetworkStats.METERED_NO; import static android.net.NetworkStats.METERED_NO;
@@ -50,7 +50,7 @@ import android.util.Log;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.IndentingPrintWriter;
import com.android.server.connectivity.tethering.OffloadHardwareInterface.ForwardedStats; import com.android.networkstack.tethering.OffloadHardwareInterface.ForwardedStats;
import java.net.Inet4Address; import java.net.Inet4Address;
import java.net.Inet6Address; import java.net.Inet6Address;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.net.util.TetheringUtils.uint16; import static android.net.util.TetheringUtils.uint16;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.Manifest.permission.NETWORK_SETTINGS; import static android.Manifest.permission.NETWORK_SETTINGS;
import static android.Manifest.permission.NETWORK_STACK; import static android.Manifest.permission.NETWORK_STACK;
@@ -60,7 +60,7 @@ import static android.net.wifi.WifiManager.WIFI_AP_STATE_DISABLED;
import static android.telephony.CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED; import static android.telephony.CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED;
import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID; import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
import static com.android.server.connectivity.tethering.TetheringNotificationUpdater.DOWNSTREAM_NONE; import static com.android.networkstack.tethering.TetheringNotificationUpdater.DOWNSTREAM_NONE;
import android.app.usage.NetworkStatsManager; import android.app.usage.NetworkStatsManager;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.content.Context.TELEPHONY_SERVICE; import static android.content.Context.TELEPHONY_SERVICE;
import static android.net.ConnectivityManager.TYPE_ETHERNET; import static android.net.ConnectivityManager.TYPE_ETHERNET;
@@ -33,7 +33,6 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils; import android.text.TextUtils;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
import com.android.networkstack.tethering.R;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter;
import android.content.Context; import android.content.Context;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.net.LinkProperties; import android.net.LinkProperties;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.net.TetheringManager.TETHERING_BLUETOOTH; import static android.net.TetheringManager.TETHERING_BLUETOOTH;
import static android.net.TetheringManager.TETHERING_USB; import static android.net.TetheringManager.TETHERING_USB;
@@ -41,7 +41,6 @@ import androidx.annotation.IntRange;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
import com.android.networkstack.tethering.R;
/** /**
* A class to display tethering-related notifications. * A class to display tethering-related notifications.

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.content.pm.PackageManager.PERMISSION_GRANTED; import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.net.TetheringManager.TETHER_ERROR_NO_ACCESS_TETHERING_PERMISSION; import static android.net.TetheringManager.TETHER_ERROR_NO_ACCESS_TETHERING_PERMISSION;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.net.ConnectivityManager.TYPE_BLUETOOTH; import static android.net.ConnectivityManager.TYPE_BLUETOOTH;
import static android.net.ConnectivityManager.TYPE_ETHERNET; import static android.net.ConnectivityManager.TYPE_ETHERNET;

View File

@@ -13,7 +13,7 @@
* 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 com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import android.net.LinkProperties; import android.net.LinkProperties;
import android.net.Network; import android.net.Network;

View File

@@ -21,11 +21,11 @@
<application android:debuggable="true"> <application android:debuggable="true">
<uses-library android:name="android.test.runner" /> <uses-library android:name="android.test.runner" />
<service <service
android:name="com.android.server.connectivity.tethering.MockTetheringService" android:name="com.android.networkstack.tethering.MockTetheringService"
android:permission="android.permission.TETHER_PRIVILEGED" android:permission="android.permission.TETHER_PRIVILEGED"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="com.android.server.connectivity.tethering.TetheringService"/> <action android:name="com.android.networkstack.tethering.TetheringService"/>
</intent-filter> </intent-filter>
</service> </service>
</application> </application>

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering package com.android.networkstack.tethering
import android.net.LinkAddress import android.net.LinkAddress
import android.net.MacAddress import android.net.MacAddress
@@ -159,4 +159,4 @@ class ConnectedClientsTrackerTest {
return time return time
} }
} }
} }

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.net.TetheringManager.TETHERING_BLUETOOTH; import static android.net.TetheringManager.TETHERING_BLUETOOTH;
import static android.net.TetheringManager.TETHERING_ETHERNET; import static android.net.TetheringManager.TETHERING_ETHERNET;
@@ -59,7 +59,6 @@ import androidx.test.runner.AndroidJUnit4;
import com.android.internal.util.State; import com.android.internal.util.State;
import com.android.internal.util.StateMachine; import com.android.internal.util.StateMachine;
import com.android.internal.util.test.BroadcastInterceptingContext; import com.android.internal.util.test.BroadcastInterceptingContext;
import com.android.networkstack.tethering.R;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR; import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
import static android.net.RouteInfo.RTN_UNICAST; import static android.net.RouteInfo.RTN_UNICAST;

View File

@@ -13,7 +13,7 @@
* 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 com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.net.NetworkStats.DEFAULT_NETWORK_NO; import static android.net.NetworkStats.DEFAULT_NETWORK_NO;
import static android.net.NetworkStats.METERED_NO; import static android.net.NetworkStats.METERED_NO;
@@ -26,9 +26,9 @@ import static android.net.NetworkStats.UID_TETHERING;
import static android.net.RouteInfo.RTN_UNICAST; import static android.net.RouteInfo.RTN_UNICAST;
import static android.provider.Settings.Global.TETHER_OFFLOAD_DISABLED; import static android.provider.Settings.Global.TETHER_OFFLOAD_DISABLED;
import static com.android.server.connectivity.tethering.OffloadController.StatsType.STATS_PER_IFACE; import static com.android.networkstack.tethering.OffloadController.StatsType.STATS_PER_IFACE;
import static com.android.server.connectivity.tethering.OffloadController.StatsType.STATS_PER_UID; import static com.android.networkstack.tethering.OffloadController.StatsType.STATS_PER_UID;
import static com.android.server.connectivity.tethering.OffloadHardwareInterface.ForwardedStats; import static com.android.networkstack.tethering.OffloadHardwareInterface.ForwardedStats;
import static com.android.testutils.MiscAssertsKt.assertContainsAll; import static com.android.testutils.MiscAssertsKt.assertContainsAll;
import static com.android.testutils.MiscAssertsKt.assertThrows; import static com.android.testutils.MiscAssertsKt.assertThrows;
import static com.android.testutils.NetworkStatsUtilsKt.orderInsensitiveEquals; import static com.android.testutils.NetworkStatsUtilsKt.orderInsensitiveEquals;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.net.ConnectivityManager.TYPE_ETHERNET; import static android.net.ConnectivityManager.TYPE_ETHERNET;
import static android.net.ConnectivityManager.TYPE_MOBILE; import static android.net.ConnectivityManager.TYPE_MOBILE;
@@ -44,7 +44,6 @@ import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import com.android.internal.util.test.BroadcastInterceptingContext; import com.android.internal.util.test.BroadcastInterceptingContext;
import com.android.networkstack.tethering.R;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering package com.android.networkstack.tethering
import android.app.Notification import android.app.Notification
import android.app.NotificationManager import android.app.NotificationManager
@@ -29,8 +29,7 @@ import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest
import androidx.test.runner.AndroidJUnit4 import androidx.test.runner.AndroidJUnit4
import com.android.internal.util.test.BroadcastInterceptingContext import com.android.internal.util.test.BroadcastInterceptingContext
import com.android.networkstack.tethering.R import com.android.networkstack.tethering.TetheringNotificationUpdater.DOWNSTREAM_NONE
import com.android.server.connectivity.tethering.TetheringNotificationUpdater.DOWNSTREAM_NONE
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
@@ -259,4 +258,4 @@ class TetheringNotificationUpdaterTest {
notificationUpdater.notifyTetheringDisabledByRestriction() notificationUpdater.notifyTetheringDisabledByRestriction()
verifyNotification(R.drawable.stat_sys_tether_general, disallowTitle, disallowMessage) verifyNotification(R.drawable.stat_sys_tether_general, disallowTitle, disallowMessage)
} }
} }

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.net.TetheringManager.TETHERING_WIFI; import static android.net.TetheringManager.TETHERING_WIFI;
import static android.net.TetheringManager.TETHER_ERROR_NO_ERROR; import static android.net.TetheringManager.TETHER_ERROR_NO_ERROR;
@@ -37,7 +37,7 @@ import androidx.test.filters.SmallTest;
import androidx.test.rule.ServiceTestRule; import androidx.test.rule.ServiceTestRule;
import androidx.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import com.android.server.connectivity.tethering.MockTetheringService.MockTetheringConnector; import com.android.networkstack.tethering.MockTetheringService.MockTetheringConnector;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.hardware.usb.UsbManager.USB_CONFIGURED; import static android.hardware.usb.UsbManager.USB_CONFIGURED;
import static android.hardware.usb.UsbManager.USB_CONNECTED; import static android.hardware.usb.UsbManager.USB_CONNECTED;
@@ -47,7 +47,7 @@ import static android.net.wifi.WifiManager.IFACE_IP_MODE_TETHERED;
import static android.net.wifi.WifiManager.WIFI_AP_STATE_ENABLED; import static android.net.wifi.WifiManager.WIFI_AP_STATE_ENABLED;
import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID; import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
import static com.android.server.connectivity.tethering.TetheringNotificationUpdater.DOWNSTREAM_NONE; import static com.android.networkstack.tethering.TetheringNotificationUpdater.DOWNSTREAM_NONE;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@@ -137,7 +137,6 @@ import com.android.internal.util.ArrayUtils;
import com.android.internal.util.StateMachine; import com.android.internal.util.StateMachine;
import com.android.internal.util.test.BroadcastInterceptingContext; import com.android.internal.util.test.BroadcastInterceptingContext;
import com.android.internal.util.test.FakeSettingsProvider; import com.android.internal.util.test.FakeSettingsProvider;
import com.android.networkstack.tethering.R;
import com.android.testutils.MiscAssertsKt; import com.android.testutils.MiscAssertsKt;
import org.junit.After; import org.junit.After;

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.server.connectivity.tethering; package com.android.networkstack.tethering;
import static android.net.ConnectivityManager.TYPE_MOBILE_DUN; import static android.net.ConnectivityManager.TYPE_MOBILE_DUN;
import static android.net.ConnectivityManager.TYPE_MOBILE_HIPRI; import static android.net.ConnectivityManager.TYPE_MOBILE_HIPRI;
@@ -24,7 +24,7 @@ import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR; import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
import static android.net.NetworkCapabilities.TRANSPORT_WIFI; import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
import static com.android.server.connectivity.tethering.UpstreamNetworkMonitor.TYPE_NONE; import static com.android.networkstack.tethering.UpstreamNetworkMonitor.TYPE_NONE;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;