Merge "Remove hard-coded NetworkStack package name" am: e765e8b7aa

am: d49230d8df

Change-Id: If82997f9f46a34014e797f10a71c34bfb4150585
This commit is contained in:
Remi NGUYEN VAN
2019-02-11 20:34:20 -08:00
committed by android-build-merger
6 changed files with 6 additions and 10 deletions

View File

@@ -24,7 +24,7 @@ oneway interface INetworkMonitorCallbacks {
void onNetworkMonitorCreated(in INetworkMonitor networkMonitor);
void notifyNetworkTested(int testResult, @nullable String redirectUrl);
void notifyPrivateDnsConfigResolved(in PrivateDnsConfigParcel config);
void showProvisioningNotification(String action);
void showProvisioningNotification(String action, String packageName);
void hideProvisioningNotification();
void logCaptivePortalLoginEvent(int eventId, String packageName);
}

View File

@@ -63,9 +63,6 @@ public class NetworkStack {
public static final String PERMISSION_MAINLINE_NETWORK_STACK =
"android.permission.MAINLINE_NETWORK_STACK";
/** @hide */
public static final String NETWORKSTACK_PACKAGE_NAME = "com.android.mainline.networkstack";
private static final int NETWORKSTACK_TIMEOUT_MS = 10_000;
@NonNull

View File

@@ -500,7 +500,7 @@ public class NetworkMonitor extends StateMachine {
private void showProvisioningNotification(String action) {
try {
mCallback.showProvisioningNotification(action);
mCallback.showProvisioningNotification(action, mContext.getPackageName());
} catch (RemoteException e) {
Log.e(TAG, "Error showing provisioning notification", e);
}

View File

@@ -482,7 +482,7 @@ public class NetworkMonitorTest {
nm.notifyNetworkConnected();
verify(mCallbacks, timeout(HANDLER_TIMEOUT_MS).times(1))
.showProvisioningNotification(any());
.showProvisioningNotification(any(), any());
// Check that startCaptivePortalApp sends the expected intent.
nm.launchCaptivePortalApp();

View File

@@ -38,7 +38,6 @@ import static android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED;
import static android.net.NetworkCapabilities.TRANSPORT_VPN;
import static android.net.NetworkPolicyManager.RULE_NONE;
import static android.net.NetworkPolicyManager.uidRulesToString;
import static android.net.NetworkStack.NETWORKSTACK_PACKAGE_NAME;
import static android.net.shared.NetworkMonitorUtils.isValidationRequired;
import static android.net.shared.NetworkParcelableUtil.toStableParcelable;
import static android.os.Process.INVALID_UID;
@@ -2666,9 +2665,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
}
@Override
public void showProvisioningNotification(String action) {
public void showProvisioningNotification(String action, String packageName) {
final Intent intent = new Intent(action);
intent.setPackage(NETWORKSTACK_PACKAGE_NAME);
intent.setPackage(packageName);
final PendingIntent pendingIntent;
// Only the system server can register notifications with package "android"

View File

@@ -554,7 +554,7 @@ public class ConnectivityServiceTest {
if (mNmValidationRedirectUrl != null) {
mNmCallbacks.showProvisioningNotification(
"test_provisioning_notif_action");
"test_provisioning_notif_action", "com.android.test.package");
mNmProvNotificationRequested = true;
}
} catch (RemoteException e) {