diff --git a/src/com/android/settings/network/TetherProvisioningActivity.java b/src/com/android/settings/network/TetherProvisioningActivity.java
index 230cfe0..09efe48 100644
--- a/src/com/android/settings/network/TetherProvisioningActivity.java
+++ b/src/com/android/settings/network/TetherProvisioningActivity.java
@@ -21,12 +21,16 @@
 import android.content.pm.PackageManager;
 import android.content.res.Resources;
 import android.net.ConnectivityManager;
+import android.net.TetheringConstants;
+import android.net.TetheringManager;
 import android.os.Bundle;
 import android.os.ResultReceiver;
 import android.os.UserHandle;
 import android.telephony.SubscriptionManager;
 import android.util.Log;
 
+import androidx.annotation.VisibleForTesting;
+
 import com.android.settings.Utils;
 
 /**
@@ -36,17 +40,18 @@
  * with {@link android.permission.TETHER_PRIVILEGED}.
  */
 public class TetherProvisioningActivity extends Activity {
-    private static final int PROVISION_REQUEST = 0;
     private static final String TAG = "TetherProvisioningAct";
     private static final String EXTRA_TETHER_TYPE = "TETHER_TYPE";
-    private static final String EXTRA_SUBID = "subId";
     private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
     private ResultReceiver mResultReceiver;
+    @VisibleForTesting
+    static final int PROVISION_REQUEST = 0;
+    @VisibleForTesting
+    static final String EXTRA_SUBID = "subId";
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-
         mResultReceiver = (ResultReceiver)getIntent().getParcelableExtra(
                 ConnectivityManager.EXTRA_PROVISION_CALLBACK);
 
@@ -58,16 +63,22 @@
         final int subId = SubscriptionManager.getActiveDataSubscriptionId();
         if (tetherSubId != subId) {
             Log.e(TAG, "This Provisioning request is outdated, current subId: " + subId);
+            mResultReceiver.send(TetheringManager.TETHER_ERROR_PROVISIONING_FAILED, null);
+            finish();
             return;
         }
-        final Resources res = Utils.getResourcesForSubId(this, subId);
-        final String[] provisionApp = res.getStringArray(
-                com.android.internal.R.array.config_mobile_hotspot_provision_app);
-
+        String[] provisionApp = getIntent().getStringArrayExtra(
+                TetheringConstants.EXTRA_RUN_PROVISION);
+        if (provisionApp == null || provisionApp.length < 2) {
+            final Resources res = Utils.getResourcesForSubId(this, subId);
+            provisionApp = res.getStringArray(
+                    com.android.internal.R.array.config_mobile_hotspot_provision_app);
+        }
         final Intent intent = new Intent(Intent.ACTION_MAIN);
         intent.setClassName(provisionApp[0], provisionApp[1]);
         intent.putExtra(EXTRA_TETHER_TYPE, tetherType);
         intent.putExtra(SubscriptionManager.EXTRA_SUBSCRIPTION_INDEX, subId);
+        intent.putExtra(ConnectivityManager.EXTRA_PROVISION_CALLBACK, mResultReceiver);
         if (DEBUG) {
             Log.d(TAG, "Starting provisioning app: " + provisionApp[0] + "." + provisionApp[1]);
         }
@@ -75,7 +86,7 @@
         if (getPackageManager().queryIntentActivities(intent,
                 PackageManager.MATCH_DEFAULT_ONLY).isEmpty()) {
             Log.e(TAG, "Provisioning app is configured, but not available.");
-            mResultReceiver.send(ConnectivityManager.TETHER_ERROR_PROVISION_FAILED, null);
+            mResultReceiver.send(TetheringManager.TETHER_ERROR_PROVISIONING_FAILED, null);
             finish();
             return;
         }
@@ -89,8 +100,8 @@
         if (requestCode == PROVISION_REQUEST) {
             if (DEBUG) Log.d(TAG, "Got result from app: " + resultCode);
             int result = resultCode == Activity.RESULT_OK ?
-                    ConnectivityManager.TETHER_ERROR_NO_ERROR :
-                    ConnectivityManager.TETHER_ERROR_PROVISION_FAILED;
+                    TetheringManager.TETHER_ERROR_NO_ERROR :
+                    TetheringManager.TETHER_ERROR_PROVISIONING_FAILED;
             mResultReceiver.send(result, null);
             finish();
         }
diff --git a/tests/unit/Android.bp b/tests/unit/Android.bp
index 43bf02c..583b46e 100644
--- a/tests/unit/Android.bp
+++ b/tests/unit/Android.bp
@@ -12,6 +12,7 @@
     ],
 
     static_libs: [
+        "androidx.test.core",
         "androidx.test.rules",
         "androidx.test.espresso.core",
         "androidx.test.espresso.contrib-nodeps",
diff --git a/tests/unit/AndroidTest.xml b/tests/unit/AndroidTest.xml
index b9321a3..9ce7657 100644
--- a/tests/unit/AndroidTest.xml
+++ b/tests/unit/AndroidTest.xml
@@ -19,6 +19,7 @@
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="SettingsUnitTests.apk" />
+        <option name="test-file-name" value="InstrumentedEntitlementApp.apk" />
     </target_preparer>
 
     <option name="test-tag" value="SettingsUnitTests" />
diff --git a/tests/unit/InstrumentedEntitlementApp/Android.bp b/tests/unit/InstrumentedEntitlementApp/Android.bp
new file mode 100644
index 0000000..dacd32a
--- /dev/null
+++ b/tests/unit/InstrumentedEntitlementApp/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 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.
+
+android_test {
+    name: "InstrumentedEntitlementApp",
+    srcs: ["src/**/*.java"],
+    test_suites: ["device-tests"],
+}
diff --git a/tests/unit/InstrumentedEntitlementApp/AndroidManifest.xml b/tests/unit/InstrumentedEntitlementApp/AndroidManifest.xml
new file mode 100644
index 0000000..b123079
--- /dev/null
+++ b/tests/unit/InstrumentedEntitlementApp/AndroidManifest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="android.test.entitlement">
+
+    <application>
+        <activity android:name=".InstrumentedEntitlementActivity"
+                  android:label="InstrumentedEntitlementActivity"
+                  android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
diff --git a/tests/unit/InstrumentedEntitlementApp/src/android/test/entitlement/InstrumentedEntitlementActivity.java b/tests/unit/InstrumentedEntitlementApp/src/android/test/entitlement/InstrumentedEntitlementActivity.java
new file mode 100644
index 0000000..2439746
--- /dev/null
+++ b/tests/unit/InstrumentedEntitlementApp/src/android/test/entitlement/InstrumentedEntitlementActivity.java
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 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.test.entitlement;
+
+import android.app.Activity;
+
+// Instrumented activity for TetherProvisioningActivityTest
+public class InstrumentedEntitlementActivity extends Activity {
+}
diff --git a/tests/unit/src/com/android/settings/network/TetherProvisioningActivityTest.java b/tests/unit/src/com/android/settings/network/TetherProvisioningActivityTest.java
new file mode 100644
index 0000000..f762888
--- /dev/null
+++ b/tests/unit/src/com/android/settings/network/TetherProvisioningActivityTest.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2020 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 com.android.settings.network;
+
+import static android.net.TetheringConstants.EXTRA_ADD_TETHER_TYPE;
+import static android.net.TetheringConstants.EXTRA_PROVISION_CALLBACK;
+import static android.net.TetheringConstants.EXTRA_RUN_PROVISION;
+import static android.net.TetheringManager.TETHERING_WIFI;
+
+import static com.android.settings.network.TetherProvisioningActivity.PROVISION_REQUEST;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.TetheringManager;
+import android.os.Bundle;
+import android.os.ResultReceiver;
+import android.provider.Settings;
+import android.telephony.SubscriptionManager;
+
+import androidx.lifecycle.Lifecycle;
+import androidx.test.core.app.ActivityScenario;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+
+@RunWith(AndroidJUnit4.class)
+public class TetherProvisioningActivityTest {
+    private static class WrappedReceiver extends ResultReceiver {
+        private final CompletableFuture<Integer> mFuture = new CompletableFuture<>();
+
+        WrappedReceiver() {
+            super(null /* handler */);
+        }
+
+        @Override
+        protected void onReceiveResult(int resultCode, Bundle resultData) {
+            mFuture.complete(resultCode);
+        }
+
+        public int get() throws Exception {
+            return mFuture.get(10_000L, TimeUnit.MILLISECONDS);
+        }
+    }
+
+    @Test
+    public void testOnCreate_FinishWithNonActiveDataSubId() throws Exception {
+        final WrappedReceiver receiver = new WrappedReceiver();
+        try (ActivityScenario<TetherProvisioningActivity> scenario = ActivityScenario.launch(
+                new Intent(Settings.ACTION_TETHER_PROVISIONING_UI)
+                        .putExtra(EXTRA_ADD_TETHER_TYPE, TETHERING_WIFI)
+                        .putExtra(EXTRA_PROVISION_CALLBACK, receiver)
+                        .putExtra(TetherProvisioningActivity.EXTRA_SUBID, 10000))) {
+            assertEquals(TetheringManager.TETHER_ERROR_PROVISIONING_FAILED, receiver.get());
+            //assertEquals(Lifecycle.State.DESTROYED, scenario.getState());
+        }
+    }
+
+    @Test
+    public void testOnCreate_FinishWithUnavailableProvisioningApp() throws Exception {
+        final WrappedReceiver receiver = new WrappedReceiver();
+        final int subId = SubscriptionManager.getActiveDataSubscriptionId();
+        try (ActivityScenario<TetherProvisioningActivity> scenario = ActivityScenario.launch(
+                new Intent(Settings.ACTION_TETHER_PROVISIONING_UI)
+                        .putExtra(EXTRA_ADD_TETHER_TYPE, TETHERING_WIFI)
+                        .putExtra(EXTRA_PROVISION_CALLBACK, receiver)
+                        .putExtra(TetherProvisioningActivity.EXTRA_SUBID, subId)
+                        .putExtra(EXTRA_RUN_PROVISION, new String[] { "", "" }))) {
+            assertEquals(TetheringManager.TETHER_ERROR_PROVISIONING_FAILED, receiver.get());
+            assertEquals(Lifecycle.State.DESTROYED, scenario.getState());
+        }
+    }
+
+    @Test
+    public void testOnCreate_startActivityForResult() {
+        final WrappedReceiver receiver = new WrappedReceiver();
+        final int subId = SubscriptionManager.getActiveDataSubscriptionId();
+        final String[] provisionApp = new String[] {
+                "android.test.entitlement",
+                "android.test.entitlement.InstrumentedEntitlementActivity"
+        };
+        try (ActivityScenario<TetherProvisioningActivity> scenario = ActivityScenario.launch(
+                new Intent(Settings.ACTION_TETHER_PROVISIONING_UI)
+                        .putExtra(EXTRA_ADD_TETHER_TYPE, TETHERING_WIFI)
+                        .putExtra(EXTRA_PROVISION_CALLBACK, receiver)
+                        .putExtra(TetherProvisioningActivity.EXTRA_SUBID, subId)
+                        .putExtra(EXTRA_RUN_PROVISION, provisionApp))) {
+            scenario.onActivity(activity -> {
+                assertFalse(activity.isFinishing());
+                activity.onActivityResult(PROVISION_REQUEST, Activity.RESULT_OK, null /* intent */);
+                try {
+                    assertEquals(TetheringManager.TETHER_ERROR_NO_ERROR, receiver.get());
+                } catch (Exception e) {
+                    // ActivityAction#perform() doesn't throw the exception. Just catch the
+                    // exception and call fail() here.
+                    fail("Can not get result after 10s.");
+                }
+                assertTrue(activity.isFinishing());
+            });
+        }
+    }
+}
