aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java
diff options
context:
space:
mode:
authorDan Zivkovic <zivkovic@google.com>2015-01-14 17:58:47 -0800
committerDan Zivkovic <zivkovic@google.com>2015-01-16 09:37:30 -0800
commitd913617e0cecc2628c3729933c365d76f45f5504 (patch)
tree11072adbb2fdf4261b7ff9a16f8902087b752645 /java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java
parent4e395e119f905f1f33687a6cea8c9fe8a8d53b0e (diff)
downloadlatinime-d913617e0cecc2628c3729933c365d76f45f5504.tar.gz
latinime-d913617e0cecc2628c3729933c365d76f45f5504.tar.xz
latinime-d913617e0cecc2628c3729933c365d76f45f5504.zip
AOSP change for showing the app icon.
This change deletes a bunch of code that was used to conditionally show/hide the keyboard app icon given system states and user preferences. Bug 19001197. Change-Id: I69a57aa21872a571af87a193b3e52b7f985e5168
Diffstat (limited to 'java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java')
-rw-r--r--java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java41
1 files changed, 14 insertions, 27 deletions
diff --git a/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java b/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java
index 982d4c690..db5e632ae 100644
--- a/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java
+++ b/java/src/com/android/inputmethod/latin/SystemBroadcastReceiver.java
@@ -17,16 +17,17 @@
package com.android.inputmethod.latin;
import android.content.BroadcastReceiver;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.os.Process;
import android.util.Log;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
-import com.android.inputmethod.compat.IntentCompatUtils;
import com.android.inputmethod.keyboard.KeyboardLayoutSet;
-import com.android.inputmethod.latin.setup.LauncherIconVisibilityManager;
+import com.android.inputmethod.latin.setup.SetupActivity;
import com.android.inputmethod.latin.utils.UncachedInputMethodManagerUtils;
/**
@@ -34,26 +35,6 @@ import com.android.inputmethod.latin.utils.UncachedInputMethodManagerUtils;
* package has been replaced by a newer version of the same package. This class also detects
* {@link Intent#ACTION_BOOT_COMPLETED} and {@link Intent#ACTION_USER_INITIALIZE} broadcast intent.
*
- * If this IME has already been installed in the system image and a new version of this IME has
- * been installed, {@link Intent#ACTION_MY_PACKAGE_REPLACED} is received by this receiver and it
- * will hide the setup wizard's icon.
- *
- * If this IME has already been installed in the data partition and a new version of this IME has
- * been installed, {@link Intent#ACTION_MY_PACKAGE_REPLACED} is received by this receiver but it
- * will not hide the setup wizard's icon, and the icon will appear on the launcher.
- *
- * If this IME hasn't been installed yet and has been newly installed, no
- * {@link Intent#ACTION_MY_PACKAGE_REPLACED} will be sent and the setup wizard's icon will appear
- * on the launcher.
- *
- * When the device has been booted, {@link Intent#ACTION_BOOT_COMPLETED} is received by this
- * receiver and it checks whether the setup wizard's icon should be appeared or not on the launcher
- * depending on which partition this IME is installed.
- *
- * When a multiuser account has been created, {@link Intent#ACTION_USER_INITIALIZE} is received
- * by this receiver and it checks the whether the setup wizard's icon should be appeared or not on
- * the launcher depending on which partition this IME is installed.
- *
* When the system locale has been changed, {@link Intent#ACTION_LOCALE_CHANGED} is received by
* this receiver and the {@link KeyboardLayoutSet}'s cache is cleared.
*/
@@ -71,13 +52,10 @@ public final class SystemBroadcastReceiver extends BroadcastReceiver {
final RichInputMethodManager richImm = RichInputMethodManager.getInstance();
final InputMethodSubtype[] additionalSubtypes = richImm.getAdditionalSubtypes();
richImm.setAdditionalInputMethodSubtypes(additionalSubtypes);
- LauncherIconVisibilityManager.updateSetupWizardIconVisibility(context);
+ showAppIcon(context);
} else if (Intent.ACTION_BOOT_COMPLETED.equals(intentAction)) {
Log.i(TAG, "Boot has been completed");
- LauncherIconVisibilityManager.updateSetupWizardIconVisibility(context);
- } else if (IntentCompatUtils.is_ACTION_USER_INITIALIZE(intentAction)) {
- Log.i(TAG, "User initialize");
- LauncherIconVisibilityManager.updateSetupWizardIconVisibility(context);
+ showAppIcon(context);
} else if (Intent.ACTION_LOCALE_CHANGED.equals(intentAction)) {
Log.i(TAG, "System locale changed");
KeyboardLayoutSet.onSystemLocaleChanged();
@@ -100,4 +78,13 @@ public final class SystemBroadcastReceiver extends BroadcastReceiver {
Process.killProcess(myPid);
}
}
+
+ private static void showAppIcon(final Context context) {
+ final ComponentName setupWizardActivity = new ComponentName(context, SetupActivity.class);
+ final PackageManager pm = context.getPackageManager();
+ pm.setComponentEnabledSetting(
+ setupWizardActivity,
+ PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
+ PackageManager.DONT_KILL_APP);
+ }
}