Remove hardwired phone number from Sms Tester app
Bug 8357667
Change-Id: I6e65c9a766d6988b6c91c8006c2834da8a9f56fe
diff --git a/apptests/AndroidManifest.xml b/apptests/AndroidManifest.xml
index f38330a..41966db 100644
--- a/apptests/AndroidManifest.xml
+++ b/apptests/AndroidManifest.xml
@@ -22,6 +22,7 @@
that the new SendIntent works because the app will crash because no service
to handle the intent (without SEND_SMS permission) can be found. -->
<uses-permission android:name="android.permission.SEND_SMS_NO_CONFIRMATION" />
+ <uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- We add an application tag here just so that we can indicate that
this package needs to link against the android.test library,
diff --git a/apptests/src/com/android/mms/tests/SmsSendIntentTestActivity.java b/apptests/src/com/android/mms/tests/SmsSendIntentTestActivity.java
index 5902646..8af9bf8 100644
--- a/apptests/src/com/android/mms/tests/SmsSendIntentTestActivity.java
+++ b/apptests/src/com/android/mms/tests/SmsSendIntentTestActivity.java
@@ -17,9 +17,11 @@
package com.android.mms.apptests;
import android.app.Activity;
+import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
@@ -56,7 +58,9 @@
mRecipient = (EditText)findViewById(R.id.sms_recipient);
mMessage = (EditText)findViewById(R.id.sms_content);
- mRecipient.setText("650-933-0884"); // use this to prime a number
+ String line1Number = ((TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE))
+ .getLine1Number();
+ mRecipient.setText(line1Number); // use this to prime a number
Button sendButton = (Button) findViewById(R.id.sms_send_message);
sendButton.setOnClickListener(new OnClickListener() {