aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/setup
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/setup')
-rw-r--r--java/src/com/android/inputmethod/latin/setup/LauncherIconVisibilityManager.java85
-rw-r--r--java/src/com/android/inputmethod/latin/setup/SetupActivity.java4
-rw-r--r--java/src/com/android/inputmethod/latin/setup/SetupWizardActivity.java11
3 files changed, 10 insertions, 90 deletions
diff --git a/java/src/com/android/inputmethod/latin/setup/LauncherIconVisibilityManager.java b/java/src/com/android/inputmethod/latin/setup/LauncherIconVisibilityManager.java
deleted file mode 100644
index 3f0b10225..000000000
--- a/java/src/com/android/inputmethod/latin/setup/LauncherIconVisibilityManager.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.inputmethod.latin.setup;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.pm.PackageManager;
-import android.preference.PreferenceManager;
-import android.util.Log;
-
-import com.android.inputmethod.latin.settings.Settings;
-
-/**
- * This class handles the {@link Intent#ACTION_MY_PACKAGE_REPLACED} broadcast intent when this IME
- * package has been replaced by a newer version of the same package. This class also handles
- * {@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 to this class to 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 forwarded to this class 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 forwarded to this class
- * to check 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 forwarded to
- * this class to check whether the setup wizard's icon should be appeared or not on the launcher
- * depending on which partition this IME is installed.
- */
-public final class LauncherIconVisibilityManager {
- private static final String TAG = LauncherIconVisibilityManager.class.getSimpleName();
-
- public static void updateSetupWizardIconVisibility(final Context context) {
- final ComponentName setupWizardActivity = new ComponentName(context, SetupActivity.class);
- final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
- final boolean stateHasSet;
- if (Settings.readShowSetupWizardIcon(prefs, context)) {
- stateHasSet = setActivityState(context, setupWizardActivity,
- PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
- Log.i(TAG, (stateHasSet ? "Enable activity: " : "Activity has already been enabled: ")
- + setupWizardActivity);
- } else {
- stateHasSet = setActivityState(context, setupWizardActivity,
- PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
- Log.i(TAG, (stateHasSet ? "Disable activity: " : "Activity has already been disabled: ")
- + setupWizardActivity);
- }
- }
-
- private static boolean setActivityState(final Context context,
- final ComponentName activityComponent, final int activityState) {
- final PackageManager pm = context.getPackageManager();
- final int activityComponentState = pm.getComponentEnabledSetting(activityComponent);
- if (activityComponentState == activityState) {
- return false;
- }
- pm.setComponentEnabledSetting(
- activityComponent, activityState, PackageManager.DONT_KILL_APP);
- return true;
- }
-}
diff --git a/java/src/com/android/inputmethod/latin/setup/SetupActivity.java b/java/src/com/android/inputmethod/latin/setup/SetupActivity.java
index b770ea512..7607429f8 100644
--- a/java/src/com/android/inputmethod/latin/setup/SetupActivity.java
+++ b/java/src/com/android/inputmethod/latin/setup/SetupActivity.java
@@ -17,12 +17,8 @@
package com.android.inputmethod.latin.setup;
import android.app.Activity;
-import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
-import android.provider.Settings;
-import android.view.inputmethod.InputMethodInfo;
-import android.view.inputmethod.InputMethodManager;
public final class SetupActivity extends Activity {
@Override
diff --git a/java/src/com/android/inputmethod/latin/setup/SetupWizardActivity.java b/java/src/com/android/inputmethod/latin/setup/SetupWizardActivity.java
index e455e53d3..bee22afd5 100644
--- a/java/src/com/android/inputmethod/latin/setup/SetupWizardActivity.java
+++ b/java/src/com/android/inputmethod/latin/setup/SetupWizardActivity.java
@@ -42,10 +42,14 @@ import com.android.inputmethod.latin.utils.UncachedInputMethodManagerUtils;
import java.util.ArrayList;
+import javax.annotation.Nonnull;
+
// TODO: Use Fragment to implement welcome screen and setup steps.
public final class SetupWizardActivity extends Activity implements View.OnClickListener {
static final String TAG = SetupWizardActivity.class.getSimpleName();
+ // For debugging purpose.
+ private static final boolean FORCE_TO_SHOW_WELCOME_SCREEN = false;
private static final boolean ENABLE_WELCOME_VIDEO = true;
private InputMethodManager mImm;
@@ -80,7 +84,7 @@ public final class SetupWizardActivity extends Activity implements View.OnClickL
private final InputMethodManager mImmInHandler;
- public SettingsPoolingHandler(final SetupWizardActivity ownerInstance,
+ public SettingsPoolingHandler(@Nonnull final SetupWizardActivity ownerInstance,
final InputMethodManager imm) {
super(ownerInstance);
mImmInHandler = imm;
@@ -261,6 +265,8 @@ public final class SetupWizardActivity extends Activity implements View.OnClickL
intent.setClass(this, SettingsActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ intent.putExtra(SettingsActivity.EXTRA_ENTRY_KEY,
+ SettingsActivity.EXTRA_ENTRY_VALUE_APP_ICON);
startActivity(intent);
}
@@ -304,6 +310,9 @@ public final class SetupWizardActivity extends Activity implements View.OnClickL
private int determineSetupStepNumber() {
mHandler.cancelPollingImeSettings();
+ if (FORCE_TO_SHOW_WELCOME_SCREEN) {
+ return STEP_1;
+ }
if (!UncachedInputMethodManagerUtils.isThisImeEnabled(this, mImm)) {
return STEP_1;
}