OtaUtils.java revision e31831f42ffa08456ef0d5d1461ddc70b9d1fcfe
1af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville/* 2af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Copyright (C) 2009 The Android Open Source Project 3af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * 4af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Licensed under the Apache License, Version 2.0 (the "License"); 5af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * you may not use this file except in compliance with the License. 6af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * You may obtain a copy of the License at 7af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * 8af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * http://www.apache.org/licenses/LICENSE-2.0 9af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * 10af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Unless required by applicable law or agreed to in writing, software 11af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * distributed under the License is distributed on an "AS IS" BASIS, 12af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * See the License for the specific language governing permissions and 14af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * limitations under the License. 15af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 16af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 17af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savillepackage com.android.phone; 18af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 19af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport com.android.internal.telephony.Phone; 20af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 21af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.app.AlertDialog; 22af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.content.Context; 23af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.content.DialogInterface; 24af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.content.Intent; 25839b14d460986608fe577f89f789de854dc85b58Jim Millerimport android.content.pm.ResolveInfo; 26af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.os.AsyncResult; 27839b14d460986608fe577f89f789de854dc85b58Jim Millerimport android.os.Handler; 28839b14d460986608fe577f89f789de854dc85b58Jim Millerimport android.os.Message; 29af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.os.SystemClock; 30af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.os.SystemProperties; 31839b14d460986608fe577f89f789de854dc85b58Jim Millerimport android.provider.Settings; 32af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 33af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.util.Log; 34af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.view.KeyEvent; 35af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.view.View; 36af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.view.ViewGroup; 37af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.view.ViewStub; 38af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.view.WindowManager; 39af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 40af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.widget.Button; 41af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.widget.ToggleButton; 42af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.widget.ProgressBar; 43af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savilleimport android.widget.TextView; 44af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 45af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville/** 46af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Handles all OTA Call related logic and UI functionality. 47e31831f42ffa08456ef0d5d1461ddc70b9d1fcfeDavid Brown * The InCallScreen interacts with this class to perform an OTA Call. 48e31831f42ffa08456ef0d5d1461ddc70b9d1fcfeDavid Brown * 49e31831f42ffa08456ef0d5d1461ddc70b9d1fcfeDavid Brown * OTA is a CDMA-specific feature: 50e31831f42ffa08456ef0d5d1461ddc70b9d1fcfeDavid Brown * OTA or OTASP == Over The Air service provisioning 51e31831f42ffa08456ef0d5d1461ddc70b9d1fcfeDavid Brown * SPC == Service Programming Code 52e31831f42ffa08456ef0d5d1461ddc70b9d1fcfeDavid Brown * TODO: Include pointer to more detailed documentation. 53af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 54af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Savillepublic class OtaUtils { 55af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private static final String LOG_TAG = "OtaUtils"; 56839b14d460986608fe577f89f789de854dc85b58Jim Miller private static final String UNACTIVATED_MIN2_VALUE = "000000"; 57839b14d460986608fe577f89f789de854dc85b58Jim Miller private static final String UNACTIVATED_MIN_VALUE = "1111110111"; 58af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private static final boolean DBG = (PhoneApp.DBG_LEVEL >= 2); 59af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 60af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public static final int OTA_SHOW_ACTIVATION_SCREEN_OFF = 0; 61af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public static final int OTA_SHOW_ACTIVATION_SCREEN_ON = 1; 62af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public static final int OTA_SHOW_LISTENING_SCREEN_OFF =0; 63af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public static final int OTA_SHOW_LISTENING_SCREEN_ON =1; 64af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public static final int OTA_SHOW_ACTIVATE_FAIL_COUNT_OFF = 0; 65af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public static final int OTA_SHOW_ACTIVATE_FAIL_COUNT_THREE = 3; 66af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public static final int OTA_PLAY_SUCCESS_FAILURE_TONE_OFF = 0; 67af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public static final int OTA_PLAY_SUCCESS_FAILURE_TONE_ON = 1; 68af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 6917c36a10d09fac3e2312c0bcb839e0a704f42105w // SPC Timeout is 60 seconds 7017c36a10d09fac3e2312c0bcb839e0a704f42105w public final int OTA_SPC_TIMEOUT = 60; 71af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public final int OTA_FAILURE_DIALOG_TIMEOUT = 2; 72af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 73af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private InCallScreen mInCallScreen; 74af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private Context mContext; 75af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private PhoneApp mApplication; 76af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private OtaWidgetData mOtaWidgetData; 77af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private ViewGroup mInCallPanel; 78af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private CallCard mCallCard; 79af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private DTMFTwelveKeyDialer mDialer; 8057a38778e8c9f58b24cea1062e451934cadc4b3dJim Miller private static boolean mIsWizardMode = true; 81af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 82af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 83af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * OtaWidgetData class represent all OTA UI elements 84af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 85af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private class OtaWidgetData { 86af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public Button otaEndButton; 87af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public Button otaActivateButton; 88af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public Button otaCancelButton; 89986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller public Button otaNextButton; 90af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public ToggleButton otaSpeakerButton; 91af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public View otaCallCardBase; 92af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public View callCardOtaButtonsFailSuccess; 93af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public ProgressBar otaTextProgressBar; 94af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public TextView otaTextSuccessFail; 95af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public View callCardOtaButtonsActivate; 96af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public View callCardOtaButtonsListenProgress; 97af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public TextView otaTextActivate; 98af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public TextView otaTextListenProgress; 99af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public AlertDialog spcErrorDialog; 100af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public AlertDialog otaFailureDialog; 101986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller public TextView otaTitle; 102986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller public DTMFTwelveKeyDialerView otaDtmfDialerView; 103986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller public Button otaTryAgainButton; 104af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 105af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 106af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public OtaUtils(Context context, 107af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville InCallScreen inCallScreen, 108af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville ViewGroup inCallPanel, 109af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville CallCard callCard, 1108df5c508da2c836b841ee24120fa7c5cc92df387David Brown DTMFTwelveKeyDialer dialer) { 111af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 112af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("Enter OtaUtil constructor"); 113af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 114af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mInCallScreen = inCallScreen; 115af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mContext = context; 116af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mInCallPanel = inCallPanel; 117af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mCallCard = callCard; 118af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mDialer = dialer; 119af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication = PhoneApp.getInstance(); 120af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData = new OtaWidgetData(); 121af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 122af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville // inflate OTA Call card and footers 123af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville ViewStub otaCallCardStub = (ViewStub) mInCallScreen.findViewById(R.id.otaCallCardStub); 124af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaCallCardStub.inflate(); 125af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville readXmlSettings(); 126af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville initOtaInCallScreen(); 127af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 128a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent 129839b14d460986608fe577f89f789de854dc85b58Jim Miller /** 130839b14d460986608fe577f89f789de854dc85b58Jim Miller * Returns true if the phone needs activation. 131a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent * 132839b14d460986608fe577f89f789de854dc85b58Jim Miller * @param minString the phone's MIN configuration string 133839b14d460986608fe577f89f789de854dc85b58Jim Miller * @return true if phone needs activation 134839b14d460986608fe577f89f789de854dc85b58Jim Miller * @throws OtaConfigurationException if the string is invalid 135839b14d460986608fe577f89f789de854dc85b58Jim Miller */ 136839b14d460986608fe577f89f789de854dc85b58Jim Miller public static boolean needsActivation(String minString) throws IllegalArgumentException { 137839b14d460986608fe577f89f789de854dc85b58Jim Miller if (minString == null || (minString.length() < 6)) { 138839b14d460986608fe577f89f789de854dc85b58Jim Miller throw new IllegalArgumentException(); 139839b14d460986608fe577f89f789de854dc85b58Jim Miller } 140a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent return (minString.equals(UNACTIVATED_MIN_VALUE) 141839b14d460986608fe577f89f789de854dc85b58Jim Miller || minString.substring(0,6).equals(UNACTIVATED_MIN2_VALUE)) 142839b14d460986608fe577f89f789de854dc85b58Jim Miller || SystemProperties.getBoolean("test_cdma_setup", false); 143839b14d460986608fe577f89f789de854dc85b58Jim Miller } 144a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent 145839b14d460986608fe577f89f789de854dc85b58Jim Miller /** 146839b14d460986608fe577f89f789de854dc85b58Jim Miller * Starts the OTA provisioning call. If the MIN isn't available yet, it returns false and adds 147a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent * an event to return the request to the calling app when it becomes available. 148a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent * 149839b14d460986608fe577f89f789de854dc85b58Jim Miller * @param context 150839b14d460986608fe577f89f789de854dc85b58Jim Miller * @param handler 151839b14d460986608fe577f89f789de854dc85b58Jim Miller * @param request 152839b14d460986608fe577f89f789de854dc85b58Jim Miller * @return true if we were able to launch Ota activity or it's not required; false otherwise 153839b14d460986608fe577f89f789de854dc85b58Jim Miller */ 154839b14d460986608fe577f89f789de854dc85b58Jim Miller public static boolean maybeDoOtaCall(Context context, Handler handler, int request) { 155839b14d460986608fe577f89f789de854dc85b58Jim Miller PhoneApp app = PhoneApp.getInstance(); 156839b14d460986608fe577f89f789de854dc85b58Jim Miller Phone phone = app.phone; 157839b14d460986608fe577f89f789de854dc85b58Jim Miller 158839b14d460986608fe577f89f789de854dc85b58Jim Miller if (!isCdmaPhone()) { 159839b14d460986608fe577f89f789de854dc85b58Jim Miller if (DBG) Log.v("OtaUtils", "Can't run provisioning on a non-CDMA phone"); 160839b14d460986608fe577f89f789de854dc85b58Jim Miller return true; // sanity check - a non-cdma phone doesn't need to run this 161839b14d460986608fe577f89f789de854dc85b58Jim Miller } 162839b14d460986608fe577f89f789de854dc85b58Jim Miller 163839b14d460986608fe577f89f789de854dc85b58Jim Miller if (!phone.isMinInfoReady()) { 164839b14d460986608fe577f89f789de854dc85b58Jim Miller if (DBG) log("MIN is not ready. Registering to receive notification."); 165839b14d460986608fe577f89f789de854dc85b58Jim Miller phone.registerForSubscriptionInfoReady(handler, request, null); 166839b14d460986608fe577f89f789de854dc85b58Jim Miller return false; 167839b14d460986608fe577f89f789de854dc85b58Jim Miller } 168839b14d460986608fe577f89f789de854dc85b58Jim Miller 169839b14d460986608fe577f89f789de854dc85b58Jim Miller phone.unregisterForSubscriptionInfoReady(handler); 170839b14d460986608fe577f89f789de854dc85b58Jim Miller String min = phone.getCdmaMin(); 171839b14d460986608fe577f89f789de854dc85b58Jim Miller 172839b14d460986608fe577f89f789de854dc85b58Jim Miller if (DBG) log("min_string: " + min); 173839b14d460986608fe577f89f789de854dc85b58Jim Miller 174839b14d460986608fe577f89f789de854dc85b58Jim Miller boolean phoneNeedsActivation = false; 175839b14d460986608fe577f89f789de854dc85b58Jim Miller try { 176839b14d460986608fe577f89f789de854dc85b58Jim Miller phoneNeedsActivation = needsActivation(min); 177839b14d460986608fe577f89f789de854dc85b58Jim Miller } catch (IllegalArgumentException e) { 178839b14d460986608fe577f89f789de854dc85b58Jim Miller if (DBG) log("invalid MIN string, exit"); 179839b14d460986608fe577f89f789de854dc85b58Jim Miller return true; // If the MIN string is wrong, there's nothing else we can do. 180839b14d460986608fe577f89f789de854dc85b58Jim Miller } 181839b14d460986608fe577f89f789de854dc85b58Jim Miller 182839b14d460986608fe577f89f789de854dc85b58Jim Miller if (DBG) log("phoneNeedsActivation is set to " + phoneNeedsActivation); 183a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent 184839b14d460986608fe577f89f789de854dc85b58Jim Miller int otaShowActivationScreen = context.getResources().getInteger( 185839b14d460986608fe577f89f789de854dc85b58Jim Miller R.integer.OtaShowActivationScreen); 186839b14d460986608fe577f89f789de854dc85b58Jim Miller 187839b14d460986608fe577f89f789de854dc85b58Jim Miller if (DBG) log("otaShowActivationScreen: " + otaShowActivationScreen); 188839b14d460986608fe577f89f789de854dc85b58Jim Miller 189839b14d460986608fe577f89f789de854dc85b58Jim Miller if (phoneNeedsActivation && (otaShowActivationScreen == OTA_SHOW_ACTIVATION_SCREEN_ON)) { 190839b14d460986608fe577f89f789de854dc85b58Jim Miller app.cdmaOtaProvisionData.isOtaCallIntentProcessed = false; 191839b14d460986608fe577f89f789de854dc85b58Jim Miller Intent newIntent = new Intent(InCallScreen.ACTION_SHOW_ACTIVATION); 192839b14d460986608fe577f89f789de854dc85b58Jim Miller newIntent.setClass(context, InCallScreen.class); 193839b14d460986608fe577f89f789de854dc85b58Jim Miller newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 19457a38778e8c9f58b24cea1062e451934cadc4b3dJim Miller mIsWizardMode = false; 195839b14d460986608fe577f89f789de854dc85b58Jim Miller context.startActivity(newIntent); 196839b14d460986608fe577f89f789de854dc85b58Jim Miller if (DBG) log("activation intent sent."); 197839b14d460986608fe577f89f789de854dc85b58Jim Miller } else { 198839b14d460986608fe577f89f789de854dc85b58Jim Miller if (DBG) log("activation intent NOT sent."); 199839b14d460986608fe577f89f789de854dc85b58Jim Miller } 200839b14d460986608fe577f89f789de854dc85b58Jim Miller return true; 201839b14d460986608fe577f89f789de854dc85b58Jim Miller } 202af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 203af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void setSpeaker(boolean state) { 204af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("setSpeaker : " + state ); 205af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (state == PhoneUtils.isSpeakerOn(mContext)) { 206af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("no change. returning"); 207af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville return; 208af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 209af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 210af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (state && mInCallScreen.isBluetoothAvailable() 211af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville && mInCallScreen.isBluetoothAudioConnected()) { 212af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mInCallScreen.disconnectBluetoothAudio(); 213af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 214425b8e3c9846d5e0e76466604b35cad8856d79deEric Laurent PhoneUtils.turnOnSpeaker(mContext, state, true); 215af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 216af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 217af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 218af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Handle OTA Provision events from Framework. Possible events are: 219af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * OTA Commit Event - OTA provisioning was successful 220af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * SPC retries exceeded - SPC failure retries has exceeded, and Phone needs to 221af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * power down. 222af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 223af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public void onOtaProvisionStatusChanged(AsyncResult r) { 224af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville int OtaStatus[] = (int[]) r.result; 225af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("onOtaProvisionStatusChanged(): OtaStatus[0]" + OtaStatus[0]); 226af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 227af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowInProgressScreen(); 228af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville switch(OtaStatus[0]) { 229af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville case Phone.CDMA_OTA_PROVISION_STATUS_SPC_RETRIES_EXCEEDED: 230af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaProvisionData.otaSpcUptime = SystemClock.elapsedRealtime(); 231af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowSpcErrorNotice(OTA_SPC_TIMEOUT); 232af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville // Power.shutdown(); 233af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville break; 234af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville case Phone.CDMA_OTA_PROVISION_STATUS_COMMITTED: 235af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaProvisionData.isOtaCallCommitted = true; 236af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("onOtaProvisionStatusChanged(): isOtaCallCommitted set to true"); 237af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville break; 238af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 239af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 240af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 241af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void otaShowHome() { 242af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowHome()..."); 243af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaScreenState.otaScreenState = 244af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville CdmaOtaScreenState.OtaScreenState.OTA_STATUS_UNDEFINED; 245af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville cleanOtaScreen(); 246af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville Intent intent = new Intent(Intent.ACTION_MAIN); 247af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville intent.addCategory (Intent.CATEGORY_HOME); 248af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 249af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mContext.startActivity(intent); 250af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mInCallScreen.finish(); 251af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville return; 252af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 253af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 254af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 255af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Show Activation Screen when phone powers up and OTA provision is 256af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * required. Also shown when activation fails and user needs 257af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * to re-attempt it. Contains ACTIVE and CANCEL buttons 258af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * which allow user to start OTA activation or cancel the activation process. 259af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 260af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public void otaShowActivateScreen() { 261af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowActivationScreen()..."); 262af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mApplication.cdmaOtaConfigData.otaShowActivationScreen 263af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville == OTA_SHOW_ACTIVATION_SCREEN_ON) { 264af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowActivationScreen(): show activation screen"); 265e4a6da04f5ed72f8be2e578b91d041493277e248Paul Berman if (!isDialerOpened()) { 266af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaScreenInitialize(); 26757a38778e8c9f58b24cea1062e451934cadc4b3dJim Miller mOtaWidgetData.otaCancelButton.setVisibility(mIsWizardMode ? 26857a38778e8c9f58b24cea1062e451934cadc4b3dJim Miller View.VISIBLE : View.INVISIBLE); 269af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextActivate.setVisibility(View.VISIBLE); 270af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsActivate.setVisibility(View.VISIBLE); 271e4a6da04f5ed72f8be2e578b91d041493277e248Paul Berman } else { 2728df5c508da2c836b841ee24120fa7c5cc92df387David Brown mDialer.setHandleVisible(true); 273af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 274af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaScreenState.otaScreenState = 275af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville CdmaOtaScreenState.OtaScreenState.OTA_STATUS_ACTIVATION; 276af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } else { 277af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowActivationScreen(): show home screen"); 278af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowHome(); 279af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 280af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 281af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 282af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 283af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Show "Listen for Instruction" screen during OTA call. Shown when OTA Call 284af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * is initiated and user needs to listen for network instructions and press 285af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * appropriate DTMF digits to proceed to the "Programming in Progress" phase. 286af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 287af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void otaShowListeningScreen() { 288af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowListeningScreen()..."); 289af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mApplication.cdmaOtaConfigData.otaShowListeningScreen 290af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville == OTA_SHOW_LISTENING_SCREEN_ON) { 291af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowListeningScreen(): show listening screen"); 292e4a6da04f5ed72f8be2e578b91d041493277e248Paul Berman if (!isDialerOpened()) { 293af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaScreenInitialize(); 294af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE); 295af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_listen); 296986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaDtmfDialerView.setVisibility(View.VISIBLE); 297af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE); 298986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE); 299a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent boolean speakerOn = PhoneUtils.isSpeakerOn(mContext); 300a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent mOtaWidgetData.otaSpeakerButton.setChecked(speakerOn); 301e4a6da04f5ed72f8be2e578b91d041493277e248Paul Berman } else { 3028df5c508da2c836b841ee24120fa7c5cc92df387David Brown mDialer.setHandleVisible(true); 303af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 304af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaScreenState.otaScreenState = 305af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville CdmaOtaScreenState.OtaScreenState.OTA_STATUS_LISTENING; 306af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 307af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville // Update the state of the in-call menu items. 308af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mInCallScreen.updateMenuItems(); 309af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } else { 310af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowListeningScreen(): show progress screen"); 311af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowInProgressScreen(); 312af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 313af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 314af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 315af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 316af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Show "Programming In Progress" screen during OTA call. Shown when OTA 317af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * provisioning is in progress after user has selected an option. 318af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 319af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void otaShowInProgressScreen() { 320af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowInProgressScreen()..."); 321e4a6da04f5ed72f8be2e578b91d041493277e248Paul Berman if (!isDialerOpened()) { 322af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaScreenInitialize(); 323af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextListenProgress.setVisibility(View.VISIBLE); 324af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextListenProgress.setText(R.string.ota_progress); 325af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextProgressBar.setVisibility(View.VISIBLE); 326af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.VISIBLE); 3279bd141ba20a6cf6dcb745aca6c5c05a9c88f3a98Jim Miller mOtaWidgetData.otaSpeakerButton.setVisibility(View.VISIBLE); 328a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent boolean speakerOn = PhoneUtils.isSpeakerOn(mContext); 329a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent mOtaWidgetData.otaSpeakerButton.setChecked(speakerOn); 330e4a6da04f5ed72f8be2e578b91d041493277e248Paul Berman } else { 3318df5c508da2c836b841ee24120fa7c5cc92df387David Brown mDialer.setHandleVisible(true); 332af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 333af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaScreenState.otaScreenState = 334af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville CdmaOtaScreenState.OtaScreenState.OTA_STATUS_PROGRESS; 335af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 336af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville // Update the state of the in-call menu items. 337af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mInCallScreen.updateMenuItems(); 338af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 339af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 340af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 341af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Show programming failure dialog when OTA provisioning fails. 342af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * If OTA provisioning attempts fail more than 3 times, then unsuccessful 343af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * dialog is shown. Otherwise a two-second notice is shown with unsuccessful 344af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * information. When notice expires, phone returns to activation screen. 345af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 346986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller private void otaShowProgramFailure(int length) { 347af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowProgramFailure()..."); 348af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaProvisionData.activationCount++; 349af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if ((mApplication.cdmaOtaProvisionData.activationCount < 350af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaConfigData.otaShowActivateFailTimes) 351af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville && (mApplication.cdmaOtaConfigData.otaShowActivationScreen == 352af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville OTA_SHOW_ACTIVATION_SCREEN_ON)) { 353af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowProgramFailure(): activationCount" 354af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville + mApplication.cdmaOtaProvisionData.activationCount); 355af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowProgramFailure(): show failure notice"); 356af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowProgramFailureNotice(length); 357af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } else { 358af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowProgramFailure(): show failure dialog"); 359af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowProgramFailureDialog(); 360af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 361af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 362af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 363af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 364af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Show either programming success dialog when OTA provisioning succeeds, or 365af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * programming failure dialog when it fails. See {@link otaShowProgramFailure} 366af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * for more details. 367af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 368af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public void otaShowSuccessFailure() { 369af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowSuccessFailure()..."); 370af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaScreenInitialize(); 371af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowSuccessFailure(): isOtaCallCommitted" 372af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville + mApplication.cdmaOtaProvisionData.isOtaCallCommitted); 373af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mApplication.cdmaOtaProvisionData.isOtaCallCommitted) { 374af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowSuccessFailure(), show success dialog"); 375af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowProgramSuccessDialog(); 376af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } else { 377af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowSuccessFailure(), show failure dialog"); 378af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowProgramFailure(OTA_FAILURE_DIALOG_TIMEOUT); 379af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 380af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville return; 381af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 382af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 383af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 384af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Show programming failure dialog when OTA provisioning fails more than 3 385af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * times. 386af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 387af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void otaShowProgramFailureDialog() { 388af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowProgramFailureDialog()..."); 389af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaScreenState.otaScreenState = 390af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville CdmaOtaScreenState.OtaScreenState.OTA_STATUS_SUCCESS_FAILURE_DLG; 391986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaTitle.setText(R.string.ota_title_problem_with_activation); 392af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextSuccessFail.setVisibility(View.VISIBLE); 393af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextSuccessFail.setText(R.string.ota_unsuccessful); 394af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsFailSuccess.setVisibility(View.VISIBLE); 395986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaTryAgainButton.setVisibility(View.VISIBLE); 396af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville //close the dialer if open 397e4a6da04f5ed72f8be2e578b91d041493277e248Paul Berman if (isDialerOpened()) { 398af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mDialer.closeDialer(false); 399af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 400af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 401af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 402af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 403af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Show programming success dialog when OTA provisioning succeeds. 404af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 405af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void otaShowProgramSuccessDialog() { 406af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowProgramSuccessDialog()..."); 407af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaScreenState.otaScreenState = 408af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville CdmaOtaScreenState.OtaScreenState.OTA_STATUS_SUCCESS_FAILURE_DLG; 409986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaTitle.setText(R.string.ota_title_activate_success); 410af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextSuccessFail.setVisibility(View.VISIBLE); 411af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextSuccessFail.setText(R.string.ota_successful); 412af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsFailSuccess.setVisibility(View.VISIBLE); 413986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaNextButton.setVisibility(View.VISIBLE); 414af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville //close the dialer if open 415e4a6da04f5ed72f8be2e578b91d041493277e248Paul Berman if (isDialerOpened()) { 416af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mDialer.closeDialer(false); 417af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 418af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 419af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 420af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 421af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Show SPC failure notice when SPC attempts exceed 15 times. 422af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * During OTA provisioning, if SPC code is incorrect OTA provisioning will 423af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * fail. When SPC attempts are over 15, it shows SPC failure notice for one minute and 424af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * then phone will power down. 425af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 426af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void otaShowSpcErrorNotice(int length) { 427af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowSpcErrorNotice()..."); 428af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mOtaWidgetData.spcErrorDialog == null) { 429af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaProvisionData.inOtaSpcState = true; 430af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville DialogInterface.OnKeyListener keyListener; 431af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville keyListener = new DialogInterface.OnKeyListener() { 432af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { 433af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville log("Ignoring key events..."); 434af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville return true; 435af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville }}; 436af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.spcErrorDialog = new AlertDialog.Builder(mInCallScreen) 437af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville .setMessage(R.string.ota_spc_failure) 438af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville .setOnKeyListener(keyListener) 439af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville .create(); 440af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.spcErrorDialog.getWindow().addFlags( 441af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE 442af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 443af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.spcErrorDialog.show(); 444af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville //close the dialer if open 445e4a6da04f5ed72f8be2e578b91d041493277e248Paul Berman if (isDialerOpened()) { 446af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mDialer.closeDialer(false); 447af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 448af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville long noticeTime = length*1000; 449325cc2ced6f1ff5fb1708abfcc5e9c73ac0cd962David Brown if (DBG) log("OtaShowSpcErrorNotice(), remaining SPC noticeTime" + noticeTime); 450325cc2ced6f1ff5fb1708abfcc5e9c73ac0cd962David Brown mInCallScreen.requestCloseSpcErrorNotice(noticeTime); 451af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 452af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 453af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 454af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 455af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * When SPC notice times out, force phone to power down. 456af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 457af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public void onOtaCloseSpcNotice() { 45817c36a10d09fac3e2312c0bcb839e0a704f42105w if (DBG) log("onOtaCloseSpcNotice(), send shutdown intent"); 45917c36a10d09fac3e2312c0bcb839e0a704f42105w Intent shutdown = new Intent(Intent.ACTION_REQUEST_SHUTDOWN); 46017c36a10d09fac3e2312c0bcb839e0a704f42105w shutdown.putExtra(Intent.EXTRA_KEY_CONFIRM, false); 46117c36a10d09fac3e2312c0bcb839e0a704f42105w shutdown.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 46217c36a10d09fac3e2312c0bcb839e0a704f42105w mContext.startActivity(shutdown); 463af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 464af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 465af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 466af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Show two-second notice when OTA provisioning fails and number of failed attempts 467af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * is less then 3. 468af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 469af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void otaShowProgramFailureNotice(int length) { 470af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaShowProgramFailureNotice()..."); 471af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mOtaWidgetData.otaFailureDialog == null) { 472af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaFailureDialog = new AlertDialog.Builder(mInCallScreen) 473af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville .setMessage(R.string.ota_failure) 474af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville .create(); 475af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaFailureDialog.getWindow().addFlags( 476af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE 477af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 478af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaFailureDialog.show(); 479af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 480af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville long noticeTime = length*1000; 481325cc2ced6f1ff5fb1708abfcc5e9c73ac0cd962David Brown mInCallScreen.requestCloseOtaFailureNotice(noticeTime); 482af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 483af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 484af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 485af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 486af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Handle OTA unsuccessful notice expiry. Dismisses the 487af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * two-second notice and shows the activation screen. 488af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 489af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public void onOtaCloseFailureNotice() { 490af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("onOtaCloseFailureNotice()..."); 491af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mOtaWidgetData.otaFailureDialog != null) { 492af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaFailureDialog.dismiss(); 493af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaFailureDialog = null; 494af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 495af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowActivateScreen(); 496af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 497af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 498af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 499af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Initialize all OTA UI elements to be gone. Also set inCallPanel, 5008df5c508da2c836b841ee24120fa7c5cc92df387David Brown * callCard and the dialpad handle to be gone. This is called before any OTA screen 501af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * gets drawn. 502af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 503af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void otaScreenInitialize() { 504af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OtaScreenInitialize()..."); 505af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 506af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mInCallPanel != null) mInCallPanel.setVisibility(View.GONE); 507af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mCallCard != null) mCallCard.hideCallCardElements(); 5088df5c508da2c836b841ee24120fa7c5cc92df387David Brown mDialer.setHandleVisible(false); 509af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 510986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaTitle.setText(R.string.ota_title_activate); 511af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextActivate.setVisibility(View.GONE); 512af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextListenProgress.setVisibility(View.GONE); 513af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextProgressBar.setVisibility(View.GONE); 514af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextSuccessFail.setVisibility(View.GONE); 515af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsActivate.setVisibility(View.GONE); 516af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.GONE); 517af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsFailSuccess.setVisibility(View.GONE); 518986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaDtmfDialerView.setVisibility(View.GONE); 519986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaSpeakerButton.setVisibility(View.GONE); 520986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaTryAgainButton.setVisibility(View.GONE); 521986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaNextButton.setVisibility(View.GONE); 522af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaCallCardBase.setVisibility(View.VISIBLE); 52357a38778e8c9f58b24cea1062e451934cadc4b3dJim Miller mOtaWidgetData.otaCancelButton.setVisibility(View.VISIBLE); 524af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 525af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 526af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public void hideOtaScreen() { 527af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("hideOtaScreen()..."); 528af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 529af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsActivate.setVisibility(View.GONE); 530af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.GONE); 531af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsFailSuccess.setVisibility(View.GONE); 532af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaCallCardBase.setVisibility(View.GONE); 533af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 534af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 535e4a6da04f5ed72f8be2e578b91d041493277e248Paul Berman public boolean isDialerOpened() { 536e4a6da04f5ed72f8be2e578b91d041493277e248Paul Berman return (mDialer != null && mDialer.isOpened()); 537e4a6da04f5ed72f8be2e578b91d041493277e248Paul Berman } 538e4a6da04f5ed72f8be2e578b91d041493277e248Paul Berman 539af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 540af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Show the appropriate OTA screen based on the current state of OTA call. 541af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Shown whenever calling screen is resumed. 542af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 543af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public void otaShowProperScreen() { 544af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("otaShowProperScreen()..."); 545af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mInCallScreen.isForegroundActivity()) { 546af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("otaShowProperScreen(), OTA is foreground activity, currentstate =" 547af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville + mApplication.cdmaOtaScreenState.otaScreenState); 548af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mInCallPanel != null) { 549af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mInCallPanel.setVisibility(View.GONE); 550af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 551af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mApplication.cdmaOtaScreenState.otaScreenState 552af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville == CdmaOtaScreenState.OtaScreenState.OTA_STATUS_ACTIVATION) { 553af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowActivateScreen(); 554af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } else if (mApplication.cdmaOtaScreenState.otaScreenState 555af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville == CdmaOtaScreenState.OtaScreenState.OTA_STATUS_LISTENING) { 556af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowListeningScreen(); 557af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } else if (mApplication.cdmaOtaScreenState.otaScreenState 558af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville == CdmaOtaScreenState.OtaScreenState.OTA_STATUS_PROGRESS) { 559af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowInProgressScreen(); 560af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 561af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 562af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mApplication.cdmaOtaProvisionData.inOtaSpcState) { 563af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowSpcErrorNotice(getOtaSpcDisplayTime()); 564af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 565af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 566af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 567af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 568af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 569af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Read configuration values for each OTA screen from config.xml. 570af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * These configuration values control visibility of each screen. 571af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 572af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void readXmlSettings() { 573af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("readXmlSettings()..."); 574af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mApplication.cdmaOtaConfigData.configComplete) { 575af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville return; 576af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 577af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 578af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaConfigData.configComplete = true; 579af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville int tmpOtaShowActivationScreen = 580af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mContext.getResources().getInteger(R.integer.OtaShowActivationScreen); 581af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaConfigData.otaShowActivationScreen = tmpOtaShowActivationScreen; 582af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("readXmlSettings(), otaShowActivationScreen" 583af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville + mApplication.cdmaOtaConfigData.otaShowActivationScreen); 584af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 585af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville int tmpOtaShowListeningScreen = 586af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mContext.getResources().getInteger(R.integer.OtaShowListeningScreen); 587af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaConfigData.otaShowListeningScreen = tmpOtaShowListeningScreen; 588af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("readXmlSettings(), otaShowListeningScreen" 589af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville + mApplication.cdmaOtaConfigData.otaShowListeningScreen); 590af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 591af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville int tmpOtaShowActivateFailTimes = 592af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mContext.getResources().getInteger(R.integer.OtaShowActivateFailTimes); 593af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaConfigData.otaShowActivateFailTimes = tmpOtaShowActivateFailTimes; 594af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("readXmlSettings(), otaShowActivateFailTimes" 595af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville + mApplication.cdmaOtaConfigData.otaShowActivateFailTimes); 596af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 597af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville int tmpOtaPlaySuccessFailureTone = 598af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mContext.getResources().getInteger(R.integer.OtaPlaySuccessFailureTone); 599af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaConfigData.otaPlaySuccessFailureTone = tmpOtaPlaySuccessFailureTone; 600af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("readXmlSettings(), otaPlaySuccessFailureTone" 601af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville + mApplication.cdmaOtaConfigData.otaPlaySuccessFailureTone); 602af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 603af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 604af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 605af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Handle the click events for OTA buttons. 606af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 607af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public void onClickHandler(int id) { 608af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville switch (id) { 609af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville case R.id.otaEndButton: 610af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville onClickOtaEndButton(); 611af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville break; 612af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 613af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville case R.id.otaSpeakerButton: 614af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville onClickOtaSpeakerButton(); 615af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville break; 616af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 617af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville case R.id.otaActivateButton: 618af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville onClickOtaActivateButton(); 619af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville break; 620af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 621af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville case R.id.otaCancelButton: 622af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville onClickOtaActivateCancelButton(); 623af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville break; 624af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 625986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller case R.id.otaNextButton: 626986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller onClickOtaActivateNextButton(); 627af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville break; 628af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 629986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller case R.id.otaTryAgainButton: 630986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller onClickOtaTryAgainButton(); 631af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville break; 632af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 633af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville default: 634af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log ("onClickHandler: received a click event for unrecognized id"); 635af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville break; 636af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 637af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 638af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 639986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller private void onClickOtaTryAgainButton() { 640986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller if (DBG) log("Activation Try Again Clicked!"); 641986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller if (!mApplication.cdmaOtaProvisionData.inOtaSpcState) { 642986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller otaShowActivateScreen(); 643986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller } 644986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller } 645986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller 646af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void onClickOtaEndButton() { 647986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller if (DBG) log("Activation End Call Button Clicked!"); 648af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (!mApplication.cdmaOtaProvisionData.inOtaSpcState) { 649a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent if (PhoneUtils.hangup(mApplication.phone) == false) { 650a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent // If something went wrong when placing the OTA call, 651a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent // the screen is not updated by the call disconnect 652a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent // handler and we have to do it here 653a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent setSpeaker(false); 654a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent mInCallScreen.handleOtaCallEnd(); 655a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent } 656af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 657af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 658af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 659af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void onClickOtaSpeakerButton() { 660af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OTA Speaker button Clicked!"); 661af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (!mApplication.cdmaOtaProvisionData.inOtaSpcState) { 662af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville boolean isChecked = !PhoneUtils.isSpeakerOn(mContext); 663af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville setSpeaker(isChecked); 664af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 665af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 666af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 667af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void onClickOtaActivateButton() { 668af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("Call Activation Clicked!"); 669af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (!mApplication.cdmaOtaProvisionData.inOtaSpcState) { 670af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville Intent newIntent = new Intent(Intent.ACTION_CALL); 671af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville newIntent.putExtra(Intent.EXTRA_PHONE_NUMBER, InCallScreen.OTA_NUMBER); 672af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mInCallScreen.internalResolveIntent(newIntent); 673af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowListeningScreen(); 674af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 675af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 676af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 677af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void onClickOtaActivateCancelButton() { 678af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("Activation Cancel Clicked!"); 679af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (!mApplication.cdmaOtaProvisionData.inOtaSpcState) { 680af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowHome(); 681af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 682af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 683af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 684986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller private void onClickOtaActivateNextButton() { 685986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller if (DBG) log("Dialog Next Clicked!"); 686af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (!mApplication.cdmaOtaProvisionData.inOtaSpcState) { 687af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mApplication.cdmaOtaScreenState.otaScreenState = 688af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville CdmaOtaScreenState.OtaScreenState.OTA_STATUS_UNDEFINED; 689af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowHome(); 690af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mInCallScreen.finish(); 691af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 692af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 693af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 694af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public void dismissAllOtaDialogs() { 695af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mOtaWidgetData.spcErrorDialog != null) { 696af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("- DISMISSING mSpcErrorDialog."); 697af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.spcErrorDialog.dismiss(); 698af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.spcErrorDialog = null; 699af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 700af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mOtaWidgetData.otaFailureDialog != null) { 701af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("- DISMISSING mOtaFailureDialog."); 702af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaFailureDialog.dismiss(); 703af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaFailureDialog = null; 704af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 705af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 706af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 707af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private int getOtaSpcDisplayTime() { 708af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("getOtaSpcDisplayTime()..."); 709af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville int tmpSpcTime = 1; 710af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (mApplication.cdmaOtaProvisionData.inOtaSpcState) { 711af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville long tmpOtaSpcRunningTime = 0; 712af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville long tmpOtaSpcLeftTime = 0; 713af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville tmpOtaSpcRunningTime = SystemClock.elapsedRealtime(); 714af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville tmpOtaSpcLeftTime = 715af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville tmpOtaSpcRunningTime - mApplication.cdmaOtaProvisionData.otaSpcUptime; 71617c36a10d09fac3e2312c0bcb839e0a704f42105w if (tmpOtaSpcLeftTime >= OTA_SPC_TIMEOUT*1000) { 717af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville tmpSpcTime = 1; 718af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } else { 719af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville tmpSpcTime = OTA_SPC_TIMEOUT - (int)tmpOtaSpcLeftTime/1000; 720af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 721af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 722af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("getOtaSpcDisplayTime(), time for SPC error notice: " + tmpSpcTime); 723af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville return tmpSpcTime; 724af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 725af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 726af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 727af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Initialize the OTA widgets for all OTA screens. 728af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 729af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private void initOtaInCallScreen() { 730af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("initOtaInCallScreen()..."); 731986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaTitle = (TextView) mInCallScreen.findViewById(R.id.otaTitle); 732af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextActivate = (TextView) mInCallScreen.findViewById(R.id.otaActivate); 733af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextActivate.setVisibility(View.GONE); 734af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextListenProgress = 735af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville (TextView) mInCallScreen.findViewById(R.id.otaListenProgress); 736af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextProgressBar = 737af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville (ProgressBar) mInCallScreen.findViewById(R.id.progress_large); 738af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextProgressBar.setIndeterminate(true); 739af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaTextSuccessFail = 740af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville (TextView) mInCallScreen.findViewById(R.id.otaSuccessFailStatus); 741af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 742af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaCallCardBase = (View) mInCallScreen.findViewById(R.id.otaBase); 743af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsListenProgress = 744af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville (View) mInCallScreen.findViewById(R.id.callCardOtaListenProgress); 745af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsActivate = 746af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville (View) mInCallScreen.findViewById(R.id.callCardOtaActivate); 747af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.callCardOtaButtonsFailSuccess = 748af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville (View) mInCallScreen.findViewById(R.id.callCardOtaFailOrSuccessful); 749af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 750af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaEndButton = (Button) mInCallScreen.findViewById(R.id.otaEndButton); 751af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaEndButton.setOnClickListener(mInCallScreen); 752af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaSpeakerButton = 753af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville (ToggleButton) mInCallScreen.findViewById(R.id.otaSpeakerButton); 754af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaSpeakerButton.setOnClickListener(mInCallScreen); 755af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaActivateButton = 756af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville (Button) mInCallScreen.findViewById(R.id.otaActivateButton); 757af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaActivateButton.setOnClickListener(mInCallScreen); 758986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaCancelButton = (Button) mInCallScreen.findViewById(R.id.otaCancelButton); 759af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville mOtaWidgetData.otaCancelButton.setOnClickListener(mInCallScreen); 760986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaNextButton = (Button) mInCallScreen.findViewById(R.id.otaNextButton); 761986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaNextButton.setOnClickListener(mInCallScreen); 762986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaTryAgainButton = 763986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller (Button) mInCallScreen.findViewById(R.id.otaTryAgainButton); 764986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaTryAgainButton.setOnClickListener(mInCallScreen); 765a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent 766dfa83d531cdb88513f09e913424b7a16628b37d3David Brown mOtaWidgetData.otaDtmfDialerView = 767dfa83d531cdb88513f09e913424b7a16628b37d3David Brown (DTMFTwelveKeyDialerView) mInCallScreen.findViewById(R.id.otaDtmfDialer); 768dfa83d531cdb88513f09e913424b7a16628b37d3David Brown // Sanity-check: the otaDtmfDialer widget should *always* be present. 769dfa83d531cdb88513f09e913424b7a16628b37d3David Brown if (mOtaWidgetData.otaDtmfDialerView == null) { 770dfa83d531cdb88513f09e913424b7a16628b37d3David Brown Log.e(LOG_TAG, "onCreate: couldn't find otaDtmfDialer", new IllegalStateException()); 771af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 772dfa83d531cdb88513f09e913424b7a16628b37d3David Brown DTMFTwelveKeyDialer dialer = new DTMFTwelveKeyDialer(mInCallScreen, 7735aadc2633b13d6676598dc0954be25c108d05fcdDavid Brown mOtaWidgetData.otaDtmfDialerView, 7745aadc2633b13d6676598dc0954be25c108d05fcdDavid Brown null /* no SlidingDrawer used here */); 775dfa83d531cdb88513f09e913424b7a16628b37d3David Brown mOtaWidgetData.otaDtmfDialerView.setDialer(dialer); 776af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 777af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 778af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 779af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Clear out all OTA UI widget elements. Needs to get called 780af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * when OTA call ends or InCallScreen is destroyed. 781af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 782af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public void cleanOtaScreen() { 783af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("OTA ends, cleanOtaScreen!"); 784af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 785986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mApplication.cdmaOtaScreenState.otaScreenState = 786986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller CdmaOtaScreenState.OtaScreenState.OTA_STATUS_UNDEFINED; 787986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mApplication.cdmaOtaProvisionData.isOtaCallCommitted = false; 788986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mApplication.cdmaOtaProvisionData.isOtaCallIntentProcessed = false; 789986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mApplication.cdmaOtaProvisionData.inOtaSpcState = false; 790986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mApplication.cdmaOtaProvisionData.activationCount = 0; 791986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mApplication.cdmaOtaProvisionData.otaSpcUptime = 0; 792986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller 793986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller if (mInCallPanel != null) mInCallPanel.setVisibility(View.VISIBLE); 794986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller if (mCallCard != null) mCallCard.hideCallCardElements(); 7958df5c508da2c836b841ee24120fa7c5cc92df387David Brown mDialer.setHandleVisible(true); 796986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller 797986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaTextActivate.setVisibility(View.GONE); 798986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaTextListenProgress.setVisibility(View.GONE); 799986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaTextProgressBar.setVisibility(View.GONE); 800986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaTextSuccessFail.setVisibility(View.GONE); 801986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.callCardOtaButtonsActivate.setVisibility(View.GONE); 802986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.callCardOtaButtonsListenProgress.setVisibility(View.GONE); 803986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.callCardOtaButtonsFailSuccess.setVisibility(View.GONE); 804986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaCallCardBase.setVisibility(View.GONE); 805986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaDtmfDialerView.setVisibility(View.GONE); 806986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaNextButton.setVisibility(View.GONE); 807986d2f46bd9572b563b89627fa60a9ea0853a91fJim Miller mOtaWidgetData.otaTryAgainButton.setVisibility(View.GONE); 808a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent 809a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent // turn off the speaker in case it was turned on 810a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent // but the OTA call could not be completed 811a44a437fae34920b0ecbf66400ac50e10e5ae49eEric Laurent setSpeaker(false); 812af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 813af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 814af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 815af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Defines OTA information that needs to be maintained during 816af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * an OTA call when display orientation changes. 817af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 818af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public static class CdmaOtaProvisionData { 819af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public boolean isOtaCallCommitted; 820af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public boolean isOtaCallIntentProcessed; 821af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public boolean inOtaSpcState; 822af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public int activationCount; 823af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public long otaSpcUptime; 824af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 825af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 826af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 827af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * Defines OTA screen configuration items read from config.xml 828af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * and used to control OTA display. 829af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 830af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public static class CdmaOtaConfigData { 831af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public int otaShowActivationScreen; 832af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public int otaShowListeningScreen; 833af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public int otaShowActivateFailTimes; 834af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public int otaPlaySuccessFailureTone; 835af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public boolean configComplete; 836af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public CdmaOtaConfigData() { 837af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville if (DBG) log("CdmaOtaConfigData constructor!"); 838af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowActivationScreen = OTA_SHOW_ACTIVATION_SCREEN_OFF; 839af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowListeningScreen = OTA_SHOW_LISTENING_SCREEN_OFF; 840af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaShowActivateFailTimes = OTA_SHOW_ACTIVATE_FAIL_COUNT_OFF; 841af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaPlaySuccessFailureTone = OTA_PLAY_SUCCESS_FAILURE_TONE_OFF; 842af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 843af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 844af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 845af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville /** 846af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville * The OTA screen state machine. 847af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville */ 848af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public static class CdmaOtaScreenState { 849af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public enum OtaScreenState { 850af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville OTA_STATUS_UNDEFINED, 851af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville OTA_STATUS_ACTIVATION, 852af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville OTA_STATUS_LISTENING, 853af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville OTA_STATUS_PROGRESS, 854af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville OTA_STATUS_SUCCESS_FAILURE_DLG 855af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 856af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 857af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public OtaScreenState otaScreenState; 858af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 859af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville public CdmaOtaScreenState() { 860af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville otaScreenState = OtaScreenState.OTA_STATUS_UNDEFINED; 861af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 862af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 863af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville 864af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville private static void log(String msg) { 865af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville Log.d(LOG_TAG, msg); 866af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville } 867839b14d460986608fe577f89f789de854dc85b58Jim Miller 868839b14d460986608fe577f89f789de854dc85b58Jim Miller public static boolean isCdmaPhone() { 869839b14d460986608fe577f89f789de854dc85b58Jim Miller return PhoneApp.getInstance().phone.getPhoneName().equals("CDMA"); 870839b14d460986608fe577f89f789de854dc85b58Jim Miller } 871af684393e2c6d0c051b9d5a189c2cd1de2506831Wink Saville} 872