Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fix a bunch of STOPSHIP comments, mostly about PII logging.

TESTED:
  - normal outgoing call sequence: confirmed no PII in logs
  - normal incoming call sequence: no PII there either
  - verified the ITelephony call() and dial() APIs still work, and don't
    log any PII either.  (Added new tests to the CallDialTest activity for
    these.)
  - confirmed no remaining STOPSHIPs anywhere under apps/Phone

Bug: 5231962
Change-Id: I995bc58791f553f1a4ad51276b4b31603b196635
  • Loading branch information...
commit a841177ae2676d3ad92f82f8d378bc4915f238c9 1 parent c03d269
authored August 29, 2011
14  src/com/android/phone/CallController.java
@@ -61,7 +61,8 @@
61 61
     private static final String TAG = "CallController";
62 62
     private static final boolean DBG =
63 63
             (PhoneApp.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1);
64  
-    private static final boolean VDBG = (PhoneApp.DBG_LEVEL >= 2);
  64
+    // Do not check in with VDBG = true, since that may write PII to the system log.
  65
+    private static final boolean VDBG = false;
65 66
 
66 67
     /** The singleton CallController instance. */
67 68
     private static CallController sInstance;
@@ -139,8 +140,7 @@ public void handleMessage(Message msg) {
139 140
 
140 141
             default:
141 142
                 Log.wtf(TAG, "handleMessage: unexpected code: " + msg);
142  
-                // STOPSHIP: remove throw after initial testing, replace with "break;"
143  
-                throw new IllegalStateException("handleMessage: unexpected code: " + msg);
  143
+                break;
144 144
         }
145 145
     }
146 146
 
@@ -204,11 +204,11 @@ public void placeCall(Intent intent) {
204 204
 
205 205
         String scheme = uri.getScheme();
206 206
         String number = PhoneNumberUtils.getNumberFromIntent(intent, mApp);
207  
-        if (DBG) {
  207
+        if (VDBG) {
208 208
             log("- action: " + action);
209 209
             log("- uri: " + uri);
210 210
             log("- scheme: " + scheme);
211  
-            log("- number: " + number);  // STOPSHIP: don't log number (PII)
  211
+            log("- number: " + number);
212 212
         }
213 213
 
214 214
         // This method should only be used with the various flavors of CALL
@@ -330,7 +330,7 @@ private CallStatusCode placeCallInternal(Intent intent) {
330 330
 
331 331
         try {
332 332
             number = getInitialNumber(intent);
333  
-            if (DBG) log("- actual number to dial: '" + number + "'");  // STOPSHIP: don't log PII
  333
+            if (VDBG) log("- actual number to dial: '" + number + "'");
334 334
 
335 335
             // find the phone first
336 336
             // TODO Need a way to determine which phone to place the call
@@ -638,7 +638,7 @@ public static String getInitialNumber(Intent intent)
638 638
             String actualNumberToDial =
639 639
                     intent.getStringExtra(OutgoingCallBroadcaster.EXTRA_ACTUAL_NUMBER_TO_DIAL);
640 640
             if (VDBG) log("==> got EXTRA_ACTUAL_NUMBER_TO_DIAL; returning '"
641  
-                          + actualNumberToDial + "'");  // STOPSHIP: don't log number (PII)
  641
+                          + actualNumberToDial + "'");
642 642
             return actualNumberToDial;
643 643
         }
644 644
 
21  src/com/android/phone/OutgoingCallBroadcaster.java
@@ -55,6 +55,8 @@
55 55
     private static final String TAG = "OutgoingCallBroadcaster";
56 56
     private static final boolean DBG =
57 57
             (PhoneApp.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1);
  58
+    // Do not check in with VDBG = true, since that may write PII to the system log.
  59
+    private static final boolean VDBG = false;
58 60
 
59 61
     public static final String ACTION_SIP_SELECT_PHONE = "com.android.phone.SIP_SELECT_PHONE";
60 62
     public static final String EXTRA_ALREADY_CALLED = "android.phone.extra.ALREADY_CALLED";
@@ -111,8 +113,7 @@ public void doReceive(Context context, Intent intent) {
111 113
             // placed.)
112 114
 
113 115
             number = getResultData();
114  
-            // STOPSHIP: disable this log message before ship (PII)
115  
-            if (DBG) Log.v(TAG, "- got number from resultData: '" + number + "'");
  116
+            if (VDBG) Log.v(TAG, "- got number from resultData: '" + number + "'");
116 117
 
117 118
             final PhoneApp app = PhoneApp.getInstance();
118 119
 
@@ -189,9 +190,8 @@ public void doReceive(Context context, Intent intent) {
189 190
             number = PhoneNumberUtils.stripSeparators(number);
190 191
 
191 192
             if (DBG) Log.v(TAG, "doReceive: proceeding with call...");
192  
-            // STOPSHIP: disable these two log messages before ship (PII):
193  
-            if (DBG) Log.v(TAG, "- uri: " + uri);
194  
-            if (DBG) Log.v(TAG, "- actual number to dial: '" + number + "'");
  193
+            if (VDBG) Log.v(TAG, "- uri: " + uri);
  194
+            if (VDBG) Log.v(TAG, "- actual number to dial: '" + number + "'");
195 195
 
196 196
             startSipCallOptionHandler(context, intent, uri, number);
197 197
         }
@@ -230,11 +230,12 @@ public void doReceive(Context context, Intent intent) {
230 230
      */
231 231
     private void startSipCallOptionHandler(Context context, Intent intent,
232 232
             Uri uri, String number) {
233  
-        // Verbose debugging.  Do not check in with this enabled (PII).
234  
-        // Log.i(TAG, "startSipCallOptionHandler...");
235  
-        // Log.i(TAG, "- intent: " + intent);
236  
-        // Log.i(TAG, "- uri: " + uri);
237  
-        // Log.i(TAG, "- number: " + number);
  233
+        if (VDBG) {
  234
+            Log.i(TAG, "startSipCallOptionHandler...");
  235
+            Log.i(TAG, "- intent: " + intent);
  236
+            Log.i(TAG, "- uri: " + uri);
  237
+            Log.i(TAG, "- number: " + number);
  238
+        }
238 239
 
239 240
         // Create a copy of the original CALL intent that started the whole
240 241
         // outgoing-call sequence.  This intent will ultimately be passed to
5  src/com/android/phone/PhoneInterfaceManager.java
@@ -276,11 +276,6 @@ public void call(String number) {
276 276
 
277 277
         Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse(url));
278 278
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
279  
-        intent.setClassName(mApp, PhoneApp.getCallScreenClassName());
280  
-
281  
-        // STOPSHIP: The ACTION_CALL intent needs to go to the
282  
-        // OutgoingCallBroadcaster nowadays, not the InCallScreen!
283  
-
284 279
         mApp.startActivity(intent);
285 280
     }
286 281
 
27  src/com/android/phone/RespondViaSmsManager.java
@@ -29,6 +29,7 @@
29 29
 import android.content.res.Resources;
30 30
 import android.net.Uri;
31 31
 import android.os.Bundle;
  32
+import android.os.SystemProperties;
32 33
 import android.preference.EditTextPreference;
33 34
 import android.preference.Preference;
34 35
 import android.preference.PreferenceActivity;
@@ -48,9 +49,10 @@
48 49
  */
49 50
 public class RespondViaSmsManager {
50 51
     private static final String TAG = "RespondViaSmsManager";
51  
-    private static final boolean DBG = true;
52  
-    // STOPSHIP: reduce DBG to
53  
-    //       (PhoneApp.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1);
  52
+    private static final boolean DBG =
  53
+            (PhoneApp.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1);
  54
+    // Do not check in with VDBG = true, since that may write PII to the system log.
  55
+    private static final boolean VDBG = false;
54 56
 
55 57
     /**
56 58
      * Reference to the InCallScreen activity that owns us.  This may be
@@ -134,7 +136,7 @@ public void showRespondViaSmsPopup(Call ringingCall) {
134 136
         // chooses a response.)
135 137
 
136 138
         Connection c = ringingCall.getLatestConnection();
137  
-        if (DBG) log("- connection: " + c);
  139
+        if (VDBG) log("- connection: " + c);
138 140
 
139 141
         if (c == null) {
140 142
             // Uh oh -- the "ringingCall" doesn't have any connections any more.
@@ -154,7 +156,7 @@ public void showRespondViaSmsPopup(Call ringingCall) {
154 156
         // first place.)
155 157
 
156 158
         String phoneNumber = c.getAddress();
157  
-        if (DBG) log("- phoneNumber: " + phoneNumber);  // STOPSHIP: don't log PII
  159
+        if (VDBG) log("- phoneNumber: " + phoneNumber);
158 160
         lv.setOnItemClickListener(new RespondViaSmsItemClickListener(phoneNumber));
159 161
 
160 162
         AlertDialog.Builder builder = new AlertDialog.Builder(mInCallScreen)
@@ -199,7 +201,7 @@ public void onItemClick(AdapterView<?> parent,  // The ListView
199 201
                                 long id) {
200 202
             if (DBG) log("RespondViaSmsItemClickListener.onItemClick(" + position + ")...");
201 203
             String message = (String) parent.getItemAtPosition(position);
202  
-            if (DBG) log("- message: '" + message + "'");
  204
+            if (VDBG) log("- message: '" + message + "'");
203 205
 
204 206
             // The "Custom" choice is a special case.
205 207
             // (For now, it's guaranteed to be the last item.)
@@ -285,9 +287,8 @@ public void onCancel(DialogInterface dialog) {
285 287
      * Sends a text message without any interaction from the user.
286 288
      */
287 289
     private void sendText(String phoneNumber, String message) {
288  
-        // STOPSHIP: disable all logging of PII (everywhere in this file)
289  
-        if (DBG) log("sendText: number "
290  
-                     + phoneNumber + ", message '" + message + "'");
  290
+        if (VDBG) log("sendText: number "
  291
+                      + phoneNumber + ", message '" + message + "'");
291 292
 
292 293
         Uri uri = Uri.fromParts(Constants.SCHEME_SMSTO, phoneNumber, null);
293 294
         Intent intent = new Intent("com.android.mms.intent.action.SENDTO_NO_CONFIRMATION", uri);
@@ -299,12 +300,12 @@ private void sendText(String phoneNumber, String message) {
299 300
      * Brings up the standard SMS compose UI.
300 301
      */
301 302
     private void launchSmsCompose(String phoneNumber) {
302  
-        if (DBG) log("launchSmsCompose: number " + phoneNumber);
  303
+        if (VDBG) log("launchSmsCompose: number " + phoneNumber);
303 304
 
304 305
         Uri uri = Uri.fromParts(Constants.SCHEME_SMS, phoneNumber, null);
305 306
         Intent intent = new Intent(Intent.ACTION_VIEW, uri);
306 307
 
307  
-        if (DBG) log("- Launching SMS compose UI: " + intent);  // STOPSHIP: disable logging of PII
  308
+        if (VDBG) log("- Launching SMS compose UI: " + intent);
308 309
         mInCallScreen.startActivity(intent);
309 310
 
310 311
         // TODO: One open issue here: if the user selects "Custom message"
@@ -381,8 +382,8 @@ protected void onCreate(Bundle icicle) {
381 382
         // Preference.OnPreferenceChangeListener implementation
382 383
         public boolean onPreferenceChange(Preference preference, Object newValue) {
383 384
             if (DBG) log("onPreferenceChange: key = " + preference.getKey());
384  
-            if (DBG) log("  preference = '" + preference + "'");
385  
-            if (DBG) log("  newValue = '" + newValue + "'");
  385
+            if (VDBG) log("  preference = '" + preference + "'");
  386
+            if (VDBG) log("  newValue = '" + newValue + "'");
386 387
 
387 388
             EditTextPreference pref = (EditTextPreference) preference;
388 389
 
4  src/com/android/phone/SipCallOptionHandler.java
@@ -97,8 +97,8 @@ public void onCreate(Bundle savedInstanceState) {
97 97
         if (!OutgoingCallBroadcaster.ACTION_SIP_SELECT_PHONE.equals(action)) {
98 98
             Log.wtf(TAG, "onCreate: got intent action '" + action + "', expected "
99 99
                     + OutgoingCallBroadcaster.ACTION_SIP_SELECT_PHONE);
100  
-            // STOPSHIP: remove this throw before ship (but leave the Log.wtf())
101  
-            throw new IllegalArgumentException("Unexpected intent action '" + action + "'");
  100
+            finish();
  101
+            return;
102 102
         }
103 103
 
104 104
         // mIntent is a copy of the original CALL intent that started the
32  tests/res/layout/call_dial_test.xml
@@ -45,7 +45,7 @@
45 45
               android:textAppearance="?android:attr/textAppearanceLarge" />
46 46
     <View android:layout_width="1dip"
47 47
           android:layout_height="1dip"
48  
-          android:layout_weight="1" />
  48
+          android:layout_weight="2" />
49 49
 
50 50
     <LinearLayout
51 51
         android:orientation="horizontal"
@@ -75,6 +75,36 @@
75 75
     </LinearLayout>
76 76
     <View android:layout_width="1dip"
77 77
           android:layout_height="1dip"
  78
+          android:layout_weight="2" />
  79
+
  80
+    <LinearLayout
  81
+        android:orientation="vertical"
  82
+        android:layout_width="wrap_content"
  83
+        android:layout_height="wrap_content"
  84
+        >
  85
+        <Button android:id="@+id/itelephonyCallButton"
  86
+            android:text="@string/itelephonyCallCommand"
  87
+            android:layout_width="wrap_content"
  88
+            android:layout_height="wrap_content"
  89
+            android:layout_marginLeft="20dip"
  90
+            android:layout_marginRight="20dip"
  91
+            android:paddingLeft="32dip"
  92
+            android:paddingRight="32dip"
  93
+            android:textAppearance="?android:attr/textAppearanceMedium"
  94
+            />
  95
+        <Button android:id="@+id/itelephonyDialButton"
  96
+            android:text="@string/itelephonyDialCommand"
  97
+            android:layout_width="wrap_content"
  98
+            android:layout_height="wrap_content"
  99
+            android:layout_marginLeft="20dip"
  100
+            android:layout_marginRight="20dip"
  101
+            android:paddingLeft="32dip"
  102
+            android:paddingRight="32dip"
  103
+            android:textAppearance="?android:attr/textAppearanceMedium"
  104
+            />
  105
+    </LinearLayout>
  106
+    <View android:layout_width="1dip"
  107
+          android:layout_height="1dip"
78 108
           android:layout_weight="4" />
79 109
 
80 110
 </LinearLayout>
2  tests/res/values/donottranslate_strings.xml
@@ -22,4 +22,6 @@
22 22
     <string name="callDialTestLabel">CALL/DIAL test</string>
23 23
     <string name="callCommand">CALL</string>
24 24
     <string name="dialCommand">DIAL</string>
  25
+    <string name="itelephonyCallCommand">ITelephony.call()</string>
  26
+    <string name="itelephonyDialCommand">ITelephony.dial()</string>
25 27
 </resources>
60  tests/src/com/android/phone/tests/CallDialTest.java
@@ -21,6 +21,8 @@
21 21
 import android.content.Intent;
22 22
 import android.net.Uri;
23 23
 import android.os.Bundle;
  24
+import android.os.RemoteException;
  25
+import android.os.ServiceManager;
24 26
 import android.telephony.PhoneNumberUtils;
25 27
 import android.text.TextUtils;
26 28
 import android.util.Log;
@@ -30,6 +32,7 @@
30 32
 import android.widget.TextView;
31 33
 import android.widget.Toast;
32 34
 
  35
+import com.android.internal.telephony.ITelephony;
33 36
 import com.android.phone.Constants;
34 37
 
35 38
 /**
@@ -42,8 +45,6 @@
42 45
     // UI elements
43 46
     private TextView mLabel;
44 47
     private EditText mNumber;
45  
-    private Button mCallButton;
46  
-    private Button mDialButton;
47 48
 
48 49
     @Override
49 50
     protected void onCreate(Bundle savedInstanceState) {
@@ -59,11 +60,10 @@ protected void onCreate(Bundle savedInstanceState) {
59 60
         mNumber = (EditText) findViewById(R.id.number);
60 61
         mNumber.setText("6505551234");  // Preload it with something useful
61 62
 
62  
-        mCallButton = (Button) findViewById(R.id.callButton);
63  
-        mCallButton.setOnClickListener(this);
64  
-
65  
-        mDialButton = (Button) findViewById(R.id.dialButton);
66  
-        mDialButton.setOnClickListener(this);
  63
+        ((Button) findViewById(R.id.callButton)).setOnClickListener(this);
  64
+        ((Button) findViewById(R.id.dialButton)).setOnClickListener(this);
  65
+        ((Button) findViewById(R.id.itelephonyCallButton)).setOnClickListener(this);
  66
+        ((Button) findViewById(R.id.itelephonyDialButton)).setOnClickListener(this);
67 67
     }
68 68
 
69 69
     @Override
@@ -93,8 +93,16 @@ public void onClick(View view) {
93 93
                 log("onClick: DIAL...");
94 94
                 fireIntent(Intent.ACTION_DIAL);
95 95
                 break;
  96
+            case R.id.itelephonyCallButton:
  97
+                log("onClick: ITelephony.call()...");
  98
+                doITelephonyCall();
  99
+                break;
  100
+            case R.id.itelephonyDialButton:
  101
+                log("onClick: ITelephony.dial()...");
  102
+                doITelephonyDial();
  103
+                break;
96 104
             default:
97  
-                Log.w(LOG_TAG, "onClick: unexpected View: " + view);
  105
+                Log.wtf(LOG_TAG, "onClick: unexpected View: " + view);
98 106
                 break;
99 107
         }
100 108
     }
@@ -139,6 +147,42 @@ private void fireIntent(String action) {
139 147
         }
140 148
     }
141 149
 
  150
+    private void doITelephonyCall() {
  151
+        log("doITelephonyCall()...");
  152
+
  153
+        // Get a phone number from the EditText widget
  154
+        String number = mNumber.getText().toString();
  155
+        log("==> number: '" + number + "'");
  156
+
  157
+        try {
  158
+            ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
  159
+            log("- phone: " + phone);
  160
+            log("- calling call()...");
  161
+            phone.call(number);
  162
+            log("  Done.");
  163
+        } catch (RemoteException ex) {
  164
+            Log.w(LOG_TAG, "RemoteException!", ex);
  165
+        }
  166
+    }
  167
+
  168
+    private void doITelephonyDial() {
  169
+        log("doITelephonyDial()...");
  170
+
  171
+        // Get a phone number from the EditText widget
  172
+        String number = mNumber.getText().toString();
  173
+        log("==> number: '" + number + "'");
  174
+
  175
+        try {
  176
+            ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
  177
+            log("- phone: " + phone);
  178
+            log("- calling dial()...");
  179
+            phone.dial(number);
  180
+            log("  Done.");
  181
+        } catch (RemoteException ex) {
  182
+            Log.w(LOG_TAG, "RemoteException!", ex);
  183
+        }
  184
+    }
  185
+
142 186
     private void log(String msg) {
143 187
         Log.i(LOG_TAG, msg);
144 188
     }

0 notes on commit a841177

Please sign in to comment.
Something went wrong with that request. Please try again.