Clean up IntentCompatUtils a bit

Change-Id: I803aa6c2160bfa1ffe992b28e7eb6e8a320c9762
main
Tadashi G. Takaoka 2013-05-21 15:09:02 -07:00
parent ea88e2ffe8
commit db7d4da3e5
2 changed files with 5 additions and 6 deletions

View File

@ -21,16 +21,15 @@ import android.content.Intent;
public final class IntentCompatUtils { public final class IntentCompatUtils {
// Note that Intent.ACTION_USER_INITIALIZE have been introduced in API level 17 // Note that Intent.ACTION_USER_INITIALIZE have been introduced in API level 17
// (Build.VERSION_CODE.JELLY_BEAN_MR1). // (Build.VERSION_CODE.JELLY_BEAN_MR1).
public static final String ACTION_USER_INITIALIZE = private static final String ACTION_USER_INITIALIZE =
(String)CompatUtils.getFieldValue(null, null, (String)CompatUtils.getFieldValue(null /* receiver */, null /* defaultValue */,
CompatUtils.getField(Intent.class, "ACTION_USER_INITIALIZE")); CompatUtils.getField(Intent.class, "ACTION_USER_INITIALIZE"));
private IntentCompatUtils() { private IntentCompatUtils() {
// This utility class is not publicly instantiable. // This utility class is not publicly instantiable.
} }
public static boolean has_ACTION_USER_INITIALIZE(final Intent intent) { public static boolean is_ACTION_USER_INITIALIZE(final String action) {
return ACTION_USER_INITIALIZE != null && intent != null return ACTION_USER_INITIALIZE != null && ACTION_USER_INITIALIZE.equals(action);
&& ACTION_USER_INITIALIZE.equals(intent.getAction());
} }
} }

View File

@ -91,7 +91,7 @@ public final class LauncherIconVisibilityManager extends BroadcastReceiver {
} else if (Intent.ACTION_BOOT_COMPLETED.equals(action)) { } else if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
Log.i(TAG, "Boot has been completed"); Log.i(TAG, "Boot has been completed");
return true; return true;
} else if (IntentCompatUtils.has_ACTION_USER_INITIALIZE(intent)) { } else if (IntentCompatUtils.is_ACTION_USER_INITIALIZE(action)) {
Log.i(TAG, "User initialize"); Log.i(TAG, "User initialize");
return true; return true;
} }