Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1a280a3 authored by Jason Monk's avatar Jason Monk Committed by Android Git Automerger
Browse files

am 052e9b12: Merge "Add config to handle periodic check of tether provision" into lmp-mr1-dev

* commit '052e9b12':
  Add config to handle periodic check of tether provision
parents 99c5ac9e 052e9b12
Loading
Loading
Loading
Loading
+36 −1
Original line number Diff line number Diff line
@@ -293,6 +293,7 @@
            }

        See src/com/android/settings/TetherSettings.java for more details.
        For ui-less/periodic recheck support see config_mobile_hotspot_provision_app_no_ui
        -->
    <!-- The first element is the package name and the second element is the class name
         of the provisioning app -->
@@ -303,8 +304,42 @@
    -->
    </string-array>

    <!-- If the mobile hotspot feature requires provisioning, an action can be provided
         that will be broadcast in non-ui cases for checking the provisioning status.

         A second broadcast, action defined by config_mobile_hotspot_provision_response,
         will be sent back to notify if provisioning succeeded or not.  The response will
         match that of the activity in config_mobile_hotspot_provision_app, but instead
         contained within the int extra "EntitlementResult".

         Example Usage:
         String provisionAction = getString(R.string.config_mobile_hotspot_provision_check);
         sendBroadcast(new Intent(provisionAction));

         public void onReceive(Context context, Intent intent) {
             String provisionResponse =
                    getString(R.string.config_mobile_hotspot_provision_response);
             if (provisionResponse.equals(intent.getAction())
                    && intent.getIntExtra("EntitlementResult") == Activity.RESULT_OK) {
                 //Mobile hotspot provisioning successful
             } else {
                 //Mobile hotspot provisioning failed
             }
         }
        -->
    <string translatable="false" name="config_mobile_hotspot_provision_app_no_ui"></string>
    <!-- Sent in response to a provisioning check. The caller must hold the
         permission android.permission.CONNECTIVITY_INTERNAL for Settings to
         receive this response.

         See config_mobile_hotspot_provision_response
         -->
    <string translatable="false" name="config_mobile_hotspot_provision_response"></string>
    <!-- Number of hours between each background provisioning call -->
    <integer translatable="false" name="config_mobile_hotspot_provision_check_period">24</integer>

    <!-- Activity name to enable wifi tethering after provisioning app succeeds -->
    <string translatable="false" name="config_wifi_tether_enable">com.android.settings/.EnableWifiTether</string>
    <string translatable="false" name="config_wifi_tether_enable">com.android.settings/.TetherService</string>

    <!-- Array of ConnectivityManager.TYPE_xxxx values allowable for tethering -->
    <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+3 −0
Original line number Diff line number Diff line
@@ -1880,6 +1880,9 @@

  <!-- From Settings -->
  <java-symbol type="array" name="config_mobile_hotspot_provision_app" />
  <java-symbol type="string" name="config_mobile_hotspot_provision_app_no_ui" />
  <java-symbol type="string" name="config_mobile_hotspot_provision_response" />
  <java-symbol type="integer" name="config_mobile_hotspot_provision_check_period" />
  <java-symbol type="string" name="config_wifi_tether_enable" />
  <java-symbol type="bool" name="config_intrusiveNotificationLed" />
  <java-symbol type="dimen" name="preference_fragment_padding_bottom" />
+1 −3
Original line number Diff line number Diff line
@@ -88,9 +88,7 @@ public class HotspotTile extends QSTile<QSTile.BooleanState> {

    @Override
    protected void handleUpdateState(BooleanState state, Object arg) {
        state.visible = mController.isHotspotSupported() && mUsageTracker.isRecentlyUsed()
                && !(mController.isProvisioningNeeded() && mKeyguard.isSecure()
                && mKeyguard.isShowing());
        state.visible = mController.isHotspotSupported() && mUsageTracker.isRecentlyUsed();
        state.label = mContext.getString(R.string.quick_settings_hotspot_label);

        state.value = mController.isHotspotEnabled();
+13 −1
Original line number Diff line number Diff line
@@ -36,6 +36,14 @@ public class HotspotControllerImpl implements HotspotController {

    private static final String TAG = "HotspotController";
    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
    // Keep these in sync with Settings TetherService.java
    public static final String EXTRA_ADD_TETHER_TYPE = "extraAddTetherType";
    public static final String EXTRA_SET_ALARM = "extraSetAlarm";
    public static final String EXTRA_RUN_PROVISION = "extraRunProvision";
    public static final String EXTRA_ENABLE_WIFI_TETHER = "extraEnableWifiTether";
    // Keep this in sync with Settings TetherSettings.java
    public static final int WIFI_TETHERING = 0;

    private final ArrayList<Callback> mCallbacks = new ArrayList<Callback>();
    private final Receiver mReceiver = new Receiver();
    private final Context mContext;
@@ -97,9 +105,13 @@ public class HotspotControllerImpl implements HotspotController {
                String tetherEnable = mContext.getResources().getString(
                        com.android.internal.R.string.config_wifi_tether_enable);
                Intent intent = new Intent();
                intent.putExtra(EXTRA_ADD_TETHER_TYPE, WIFI_TETHERING);
                intent.putExtra(EXTRA_SET_ALARM, true);
                intent.putExtra(EXTRA_RUN_PROVISION, true);
                intent.putExtra(EXTRA_ENABLE_WIFI_TETHER, true);
                intent.setComponent(ComponentName.unflattenFromString(tetherEnable));
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                mContext.startActivityAsUser(intent, UserHandle.CURRENT);
                mContext.startServiceAsUser(intent, UserHandle.CURRENT);
            } else {
                int wifiState = mWifiManager.getWifiState();
                if ((wifiState == WifiManager.WIFI_STATE_ENABLING) ||