am 7e4da507: am 483b7e2d: am cd70ad54: am f23e3bf2: am 41a75d83: am 64398d93: Fix exported property on NotificationBroadcastReceiver.

* commit '7e4da50701748e7d73174d9c7c565048545edc6f':
  Fix exported property on NotificationBroadcastReceiver.
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 45769b4..8d2d62c 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -98,6 +98,8 @@
     <string name="mmiCancelled">MMI code canceled</string>
     <!-- Label for "cancel" button on the MMI dialog -->
     <string name="cancel">Cancel</string>
+    <!-- Toast string displayed to user if the input in MMI dialog is < 1 or > 160 -->
+    <string name="enter_input">USSD message must be between <xliff:g id="min_len" >%d</xliff:g> and <xliff:g id="max_len" >%d</xliff:g> characters. Please try again.</string>
 
     <!-- Label for "Manage conference call" panel [CHAR LIMIT=40] -->
     <string name="manageConferenceLabel">Manage conference call</string>
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
old mode 100644
new mode 100755
index ee837b2..1848e54
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -809,14 +809,21 @@
                 return;
             }
 
-            Cursor cursor = getContentResolver().query(data.getData(),
+            Cursor cursor = null;
+            try {
+                cursor = getContentResolver().query(data.getData(),
                     NUM_PROJECTION, null, null, null);
-            if ((cursor == null) || (!cursor.moveToFirst())) {
-                if (DBG) log("onActivityResult: bad contact data, no results found.");
+                if ((cursor == null) || (!cursor.moveToFirst())) {
+                    if (DBG) log("onActivityResult: bad contact data, no results found.");
+                    return;
+                }
+                mSubMenuVoicemailSettings.onPickActivityResult(cursor.getString(0));
                 return;
+            } finally {
+                if (cursor != null) {
+                    cursor.close();
+                }
             }
-            mSubMenuVoicemailSettings.onPickActivityResult(cursor.getString(0));
-            return;
         }
 
         super.onActivityResult(requestCode, resultCode, data);
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index 35f1ba3..87be3b8 100755
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -887,6 +887,9 @@
         mCM.unregisterForInCallVoicePrivacyOn(this);
         mCM.unregisterForInCallVoicePrivacyOff(this);
 
+        // Instantiate mSignalInfoToneGenerator
+        createSignalInfoToneGenerator();
+
         // Register all events new to the new active phone
         registerForNotifications();
     }
@@ -1288,7 +1291,8 @@
      */
     /* package */ void restartRinger() {
         if (DBG) log("restartRinger()...");
-        if (isRinging()) return;  // Already ringing; no need to restart.
+        // Already ringing or Silent requested; no need to restart.
+        if (isRinging() || mSilentRingerRequested) return;
 
         final Call ringingCall = mCM.getFirstActiveRingingCall();
         // Don't check ringingCall.isRinging() here, since that'll be true
diff --git a/src/com/android/phone/EditFdnContactScreen.java b/src/com/android/phone/EditFdnContactScreen.java
old mode 100644
new mode 100755
index cca9a9f..2992b7d
--- a/src/com/android/phone/EditFdnContactScreen.java
+++ b/src/com/android/phone/EditFdnContactScreen.java
@@ -143,14 +143,21 @@
                     if (DBG) log("onActivityResult: cancelled.");
                     return;
                 }
-                Cursor cursor = getContentResolver().query(intent.getData(),
+                Cursor cursor = null;
+                try {
+                    cursor = getContentResolver().query(intent.getData(),
                         NUM_PROJECTION, null, null, null);
-                if ((cursor == null) || (!cursor.moveToFirst())) {
-                    Log.w(LOG_TAG,"onActivityResult: bad contact data, no results found.");
-                    return;
+                    if ((cursor == null) || (!cursor.moveToFirst())) {
+                        Log.w(LOG_TAG,"onActivityResult: bad contact data, no results found.");
+                        return;
+                    }
+                    mNameField.setText(cursor.getString(0));
+                    mNumberField.setText(cursor.getString(1));
+                } finally {
+                    if (cursor != null) {
+                        cursor.close();
+                    }
                 }
-                mNameField.setText(cursor.getString(0));
-                mNumberField.setText(cursor.getString(1));
                 break;
         }
     }
diff --git a/src/com/android/phone/GsmUmtsCallForwardOptions.java b/src/com/android/phone/GsmUmtsCallForwardOptions.java
old mode 100644
new mode 100755
index 5f68135..8ecb1bf
--- a/src/com/android/phone/GsmUmtsCallForwardOptions.java
+++ b/src/com/android/phone/GsmUmtsCallForwardOptions.java
@@ -137,28 +137,35 @@
             if (DBG) Log.d(LOG_TAG, "onActivityResult: contact picker result not OK.");
             return;
         }
-        Cursor cursor = getContentResolver().query(data.getData(),
+        Cursor cursor = null;
+        try {
+            cursor = getContentResolver().query(data.getData(),
                 NUM_PROJECTION, null, null, null);
-        if ((cursor == null) || (!cursor.moveToFirst())) {
-            if (DBG) Log.d(LOG_TAG, "onActivityResult: bad contact data, no results found.");
-            return;
-        }
+            if ((cursor == null) || (!cursor.moveToFirst())) {
+                if (DBG) Log.d(LOG_TAG, "onActivityResult: bad contact data, no results found.");
+                return;
+            }
 
-        switch (requestCode) {
-            case CommandsInterface.CF_REASON_UNCONDITIONAL:
-                mButtonCFU.onPickActivityResult(cursor.getString(0));
-                break;
-            case CommandsInterface.CF_REASON_BUSY:
-                mButtonCFB.onPickActivityResult(cursor.getString(0));
-                break;
-            case CommandsInterface.CF_REASON_NO_REPLY:
-                mButtonCFNRy.onPickActivityResult(cursor.getString(0));
-                break;
-            case CommandsInterface.CF_REASON_NOT_REACHABLE:
-                mButtonCFNRc.onPickActivityResult(cursor.getString(0));
-                break;
-            default:
-                // TODO: may need exception here.
+            switch (requestCode) {
+                case CommandsInterface.CF_REASON_UNCONDITIONAL:
+                    mButtonCFU.onPickActivityResult(cursor.getString(0));
+                    break;
+                case CommandsInterface.CF_REASON_BUSY:
+                    mButtonCFB.onPickActivityResult(cursor.getString(0));
+                    break;
+                case CommandsInterface.CF_REASON_NO_REPLY:
+                    mButtonCFNRy.onPickActivityResult(cursor.getString(0));
+                    break;
+                case CommandsInterface.CF_REASON_NOT_REACHABLE:
+                    mButtonCFNRc.onPickActivityResult(cursor.getString(0));
+                    break;
+                default:
+                    // TODO: may need exception here.
+            }
+        } finally {
+            if (cursor != null) {
+                cursor.close();
+            }
         }
     }
 
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index 263a57b..4334962 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -95,6 +95,10 @@
     static final int AUDIO_RINGING = 1;  /** audio behaviour while ringing */
     static final int AUDIO_OFFHOOK = 2;  /** audio behaviour while in call. */
 
+    // USSD string length for MMI operations
+    static final int MIN_USSD_LEN = 1;
+    static final int MAX_USSD_LEN = 160;
+
     /** Speaker state, persisting between wired headset connection events */
     private static boolean sIsSpeakerEnabled = false;
 
@@ -1079,7 +1083,21 @@
                         public void onClick(DialogInterface dialog, int whichButton) {
                             switch (whichButton) {
                                 case DialogInterface.BUTTON_POSITIVE:
-                                    phone.sendUssdResponse(inputText.getText().toString());
+                                    // As per spec 24.080, valid length of ussd string
+                                    // is 1 - 160. If length is out of the range then
+                                    // display toast message & Cancel MMI operation.
+                                    if (inputText.length() < MIN_USSD_LEN
+                                            || inputText.length() > MAX_USSD_LEN) {
+                                        Toast.makeText(app,
+                                                app.getResources().getString(R.string.enter_input,
+                                                MIN_USSD_LEN, MAX_USSD_LEN),
+                                                Toast.LENGTH_LONG).show();
+                                        if (mmiCode.isCancelable()) {
+                                            mmiCode.cancel();
+                                        }
+                                    } else {
+                                        phone.sendUssdResponse(inputText.getText().toString());
+                                    }
                                     break;
                                 case DialogInterface.BUTTON_NEGATIVE:
                                     if (mmiCode.isCancelable()) {