Use "*#*#36245#*#*" to activate the debug screen.

Dial *#*#36245#*#* on the dialer to activate the debug screen.
"36245" = "email"

It's useful when
- There's no keyboard.
- There's no account set up yet.
  (You can do it by entering the special username/password on new account
  screen, but that's a bit of a pain.)

It's also easier to tell to people.

Also, removed "sensitive logging", which should never be used.

Change-Id: Id692f8b216f2d85abe1880c452d2067f170dac83
This commit is contained in:
Makoto Onuki 2010-06-30 15:43:12 -07:00
parent 75f9fab0c7
commit 42e3f10a95
8 changed files with 24 additions and 27 deletions

View File

@ -233,6 +233,12 @@
<action android:name="android.intent.action.DEVICE_STORAGE_LOW" />
<action android:name="android.intent.action.DEVICE_STORAGE_OK" />
</intent-filter>
<!-- To handle secret code to activate the debug screen. -->
<intent-filter>
<action android:name="android.provider.Telephony.SECRET_CODE" />
<!-- "36245" = "email" -->
<data android:scheme="android_secret_code" android:host="36245" />
</intent-filter>
</receiver>
<service android:name=".service.EmailBroadcastProcessorService" />

View File

@ -31,12 +31,6 @@
android:layout_height="wrap_content"
android:text="@string/debug_enable_debug_logging_label"
/>
<CheckBox
android:id="@+id/sensitive_logging"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/debug_enable_sensitive_logging_label"
/>
<!-- EXCHANGE-REMOVE-SECTION-START -->
<CheckBox
android:id="@+id/exchange_logging"

View File

@ -54,7 +54,7 @@ public class Email extends Application {
* If this is enabled than logging that normally hides sensitive information
* like passwords will show that information.
*/
public static boolean DEBUG_SENSITIVE = false;
public static final boolean DEBUG_SENSITIVE = false;
/**
* Set this to 'true' to enable as much Email logging as possible.
@ -263,7 +263,6 @@ public class Email extends Application {
super.onCreate();
Preferences prefs = Preferences.getPreferences(this);
DEBUG = prefs.getEnableDebugLogging();
DEBUG_SENSITIVE = prefs.getEnableSensitiveLogging();
setTempDirectory(this);
// Reset all accounts to default visible window

View File

@ -32,7 +32,6 @@ public class Preferences {
private static final String ACCOUNT_UUIDS = "accountUuids";
private static final String DEFAULT_ACCOUNT_UUID = "defaultAccountUuid";
private static final String ENABLE_DEBUG_LOGGING = "enableDebugLogging";
private static final String ENABLE_SENSITIVE_LOGGING = "enableSensitiveLogging";
private static final String ENABLE_EXCHANGE_LOGGING = "enableExchangeLogging";
private static final String ENABLE_EXCHANGE_FILE_LOGGING = "enableExchangeFileLogging";
private static final String DEVICE_UID = "deviceUID";
@ -141,14 +140,6 @@ public class Preferences {
return mSharedPreferences.getBoolean(ENABLE_DEBUG_LOGGING, false);
}
public void setEnableSensitiveLogging(boolean value) {
mSharedPreferences.edit().putBoolean(ENABLE_SENSITIVE_LOGGING, value).commit();
}
public boolean getEnableSensitiveLogging() {
return mSharedPreferences.getBoolean(ENABLE_SENSITIVE_LOGGING, false);
}
public void setEnableExchangeLogging(boolean value) {
mSharedPreferences.edit().putBoolean(ENABLE_EXCHANGE_LOGGING, value).commit();
}

View File

@ -292,7 +292,7 @@ public class AccountFolderList extends Activity implements AccountFolderListFrag
mSecretKeyCodeIndex++;
if (mSecretKeyCodeIndex == SECRET_KEY_CODES.length) {
mSecretKeyCodeIndex = 0;
startActivity(new Intent(this, Debug.class));
Debug.actionShow(this);
}
} else {
mSecretKeyCodeIndex = 0;

View File

@ -25,6 +25,7 @@ import com.android.exchange.utility.FileLogger;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
@ -36,12 +37,17 @@ import android.widget.CompoundButton.OnCheckedChangeListener;
public class Debug extends Activity implements OnCheckedChangeListener {
private TextView mVersionView;
private CheckBox mEnableDebugLoggingView;
private CheckBox mEnableSensitiveLoggingView;
private CheckBox mEnableExchangeLoggingView;
private CheckBox mEnableExchangeFileLoggingView;
private Preferences mPreferences;
public static void actionShow(Context context) {
Intent i = new Intent(context, Debug.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -52,16 +58,13 @@ public class Debug extends Activity implements OnCheckedChangeListener {
mVersionView = (TextView)findViewById(R.id.version);
mEnableDebugLoggingView = (CheckBox)findViewById(R.id.debug_logging);
mEnableSensitiveLoggingView = (CheckBox)findViewById(R.id.sensitive_logging);
mEnableDebugLoggingView.setOnCheckedChangeListener(this);
mEnableSensitiveLoggingView.setOnCheckedChangeListener(this);
mVersionView.setText(String.format(getString(R.string.debug_version_fmt).toString(),
getString(R.string.build_number)));
mEnableDebugLoggingView.setChecked(Email.DEBUG);
mEnableSensitiveLoggingView.setChecked(Email.DEBUG_SENSITIVE);
//EXCHANGE-REMOVE-SECTION-START
mEnableExchangeLoggingView = (CheckBox)findViewById(R.id.exchange_logging);
@ -79,10 +82,6 @@ public class Debug extends Activity implements OnCheckedChangeListener {
Email.DEBUG = isChecked;
mPreferences.setEnableDebugLogging(Email.DEBUG);
break;
case R.id.sensitive_logging:
Email.DEBUG_SENSITIVE = isChecked;
mPreferences.setEnableSensitiveLogging(Email.DEBUG_SENSITIVE);
break;
//EXCHANGE-REMOVE-SECTION-START
case R.id.exchange_logging:
mPreferences.setEnableExchangeLogging(isChecked);

View File

@ -480,7 +480,7 @@ public class AccountSetupBasics extends Activity
if (ENTER_DEBUG_SCREEN && "d@d.d".equals(email) && "debug".equals(password)) {
mEmailView.setText("");
mPasswordView.setText("");
startActivity(new Intent(this, Debug.class));
Debug.actionShow(this);
return;
}

View File

@ -20,6 +20,7 @@ import com.android.email.Email;
import com.android.email.ExchangeUtils;
import com.android.email.Preferences;
import com.android.email.VendorPolicyLoader;
import com.android.email.activity.Debug;
import android.app.IntentService;
import android.content.ComponentName;
@ -40,6 +41,10 @@ import android.util.Log;
* </ul>
*/
public class EmailBroadcastProcessorService extends IntentService {
// Dialing "*#*#36245#*#*" to open the debug screen. "36245" = "email"
private static final String SECRET_CODE_ACTION = "android.provider.Telephony.SECRET_CODE";
private static final String SECRET_CODE_HOST_DEBUG_SCREEN = "36245";
public EmailBroadcastProcessorService() {
// Class name will be the thread name.
super(EmailBroadcastProcessorService.class.getName());
@ -74,6 +79,9 @@ public class EmailBroadcastProcessorService extends IntentService {
MailService.actionCancel(this);
} else if (Intent.ACTION_DEVICE_STORAGE_OK.equals(action)) {
enableComponentsIfNecessary();
} else if (SECRET_CODE_ACTION.equals(action)
&& SECRET_CODE_HOST_DEBUG_SCREEN.equals(original.getData().getHost())) {
Debug.actionShow(this);
}
}