Skip to content

Commit

Permalink
Add "non-interactive" mode for the OTASP (CDMA provisioning) call.
Browse files Browse the repository at this point in the history
Non-voice-capable devices (like Stingray) have no built-in phone UI, but
do still need to make a special phone call when first "activating" the
device.

Till now, the code handling the OTASP call (OtaUtils.java) was very
tightly coupled to the InCallScreen, using special modes of the in-call UI
to display the "skip" and "activate" choices, and display a DTMF dialpad
and Speaker button and progress info during the call.

This change decouples the OtaUtils and InCallScreen code, and allows the
OTASP call to run in "non-interactive" mode.  Now, on data-only devices we
launch the OTASP call without involving the InCallScreen at all.

This change also cleans up the way we send results back to the
SetupWizard:

  - First of all, in non-interactive mode, we now return an activity result
    right away after kicking off the OTASP call.  This lets our caller know
    either that the OTASP call started (and is running in the background),
    or that that we couldn't start the OTASP call at all.

  - And as before, when the OTASP call ultimately finishes, we send back a
    PendingIntent that was originally provided by our caller.  But now, we
    explicitly add an extra called EXTRA_OTASP_RESULT_CODE to that
    PendingIntent.  That extra's value is an integer code, which allows
    the caller to distinguish among several possible outcomes, namely
    "success", "failure", and "user skipped".

Finally, this change includes a test activity called OtaspTestActivity which
exercises the whole "non-interactive" OTASP sequence (which basically
mimics the PERFORM_CDMA_PROVISIONING behavior of SetupWizard.)

More details:

  - When we handle the PERFORM_CDMA_PROVISIONING intent (see
    InCallScreenShowActivation.java) we check a config resource called
    R.bool.voice_capable to decide whether to use the in-call UI.  (That
    resource is true by default, but overridden to false on Stingray.)

  - The singleton OtaUtils instance is now owned by the PhoneApp, not the
    InCallScreen, since we can now have an OtaUtils instance *without* an
    InCallScreen.

  - I renamed the "com.android.phone.InCallScreen.SHOW_ACTIVATION" intent
    action to be "com.android.phone.PERFORM_CDMA_PROVISIONING", to be more
    precise, and especially to make it clear that it's not tied to the
    InCallScreen.

  - Moved all OTASP-releated string constants into OtaUtils (rather than
    having them sprinkled around in 3 or 4 places.)

Bug: 2837917

Change-Id: Ifa82591478ccb2ec9501163963944d0d0659b9ea
  • Loading branch information
David Brown committed Aug 16, 2010
1 parent 9afe1de commit b154630
Show file tree
Hide file tree
Showing 8 changed files with 987 additions and 158 deletions.
24 changes: 22 additions & 2 deletions AndroidManifest.xml
Expand Up @@ -73,6 +73,7 @@
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.SHUTDOWN" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.PERFORM_CDMA_PROVISIONING" />

<!-- This tells the activity manager to not delay any of our activity
start requests, even if they happen immediately after the user
Expand Down Expand Up @@ -202,6 +203,10 @@
</intent-filter>
</receiver>

<!-- Main in-call UI activity. This is never launched directly
from outside the phone app; instead, it's either launched by
the OutgoingCallBroadcaster (for outgoing calls), or as the
fullScreenIntent of a notification (for incoming calls.) -->
<activity android:name="InCallScreen"
android:theme="@android:style/Theme.NoTitleBar"
android:label="@string/phoneIconLabel"
Expand All @@ -212,12 +217,13 @@
android:exported="false">
</activity>

<!-- Trampoline activity that handles the PERFORM_CDMA_PROVISIONING intent. -->
<activity android:name="InCallScreenShowActivation"
android:permission="android.permission.PERFORM_CDMA_PROVISIONING"
android:label="@string/phoneIconLabel"
android:excludeFromRecents="true">
<intent-filter>
<action android:name="com.android.phone.InCallScreen.SHOW_ACTIVATION" />
<action android:name="com.android.phone.PERFORM_CDMA_PROVISIONING" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Expand Down Expand Up @@ -423,6 +429,20 @@
android:configChanges="orientation|keyboardHidden">
</activity>

<!-- Test activity mimicking the PERFORM_CDMA_PROVISIONING behavior of
SetupWizard, useful for testing "non-interactive" OTASP.
STOPSHIP: During initial Stingray OTASP testing, this is
exposed in the LAUNCHER category. It should ultimately move
into the "tests" manifest, though, at which point we can
remove it *and* the PERFORM_CDMA_PROVISIONING permission from here. -->
<activity android:name="OtaspTestActivity"
android:label="OtaspTest">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
</manifest>

68 changes: 68 additions & 0 deletions res/layout/ota_test_activity.xml
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 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.
-->

<!-- Ultra-simple test activity for triggering an OTASP call. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:gravity="center_vertical|center_horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="64dip"
>

<TextView android:id="@+id/label1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dip"
android:textAppearance="?android:attr/textAppearanceLarge"
/>

<View android:layout_width="1dip"
android:layout_height="1dip"
android:layout_weight="1" />

<ProgressBar android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="240dip"
android:layout_height="wrap_content"
android:indeterminate="true"
android:visibility="invisible" />

<TextView android:id="@+id/result1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:visibility="invisible" />

<View android:layout_width="1dip"
android:layout_height="1dip"
android:layout_weight="1" />

<Button android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:layout_marginBottom="10dip"
android:paddingLeft="32dip"
android:paddingRight="32dip"
android:textAppearance="?android:attr/textAppearanceMedium"
/>

<View android:layout_width="1dip"
android:layout_height="1dip"
android:layout_weight="1" />

</LinearLayout>
9 changes: 9 additions & 0 deletions src/com/android/phone/CallNotifier.java
Expand Up @@ -975,6 +975,15 @@ private void onDisconnect(AsyncResult r) {
mCallWaitingTonePlayer = null;
}

// If this is the end of an OTASP call, pass it on to the PhoneApp.
if (c != null && TelephonyCapabilities.supportsOtasp(mPhone)) {
final String number = c.getAddress();
if (mPhone.isOtaSpNumber(number)) {
if (DBG) log("onDisconnect: this was an OTASP call!");
mApplication.handleOtaspDisconnect();
}
}

// Check for the various tones we might need to play (thru the
// earpiece) after a call disconnects.
int toneToPlay = InCallTonePlayer.TONE_NONE;
Expand Down

0 comments on commit b154630

Please sign in to comment.