Permalink
Browse files

Remove hardwired phone number from Sms Tester app

Bug 8357667

Change-Id: I6e65c9a766d6988b6c91c8006c2834da8a9f56fe
  • Loading branch information...
1 parent 0718769 commit ae0a4a89d2995ad375075e06c7bf8f10ebdcef7b Tom Taylor committed Mar 12, 2013
@@ -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,
@@ -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 @@ protected void onCreate(Bundle savedInstanceState) {
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() {

0 comments on commit ae0a4a8

Please sign in to comment.