Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc470076 authored by Dan Zivkovic's avatar Dan Zivkovic Committed by Android (Google) Code Review
Browse files

Merge "AOSP change for showing the app icon."

parents 9fe700ec d913617e
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -18,5 +18,4 @@
*/
-->
<resources>
    <bool name="config_setup_wizard_available">false</bool>
</resources>
+0 −4
Original line number Diff line number Diff line
@@ -413,10 +413,6 @@ mobile devices. [CHAR LIMIT=25] -->
    <string name="setup_step3_action">Configure additional languages</string>
    <!-- The label of the button that finishes the setup wizard. [CHAR_LIMIT=64] -->
    <string name="setup_finish_action">Finished</string>
    <!-- Option to show setup wizard icon. [CHAR LIMIT=30]-->
    <string name="show_setup_wizard_icon">Show app icon</string>
    <!-- Description for the option to show setup wizard application icon of this IME in the laucher. [CHAR_LIMIT=65] -->
    <string name="show_setup_wizard_icon_summary">Display application icon in the launcher</string>

    <!-- The dictionary provider application name. Visible in Settings/Applications/Manage applications. -->
    <string name="app_name">Dictionary Provider</string>
+0 −6
Original line number Diff line number Diff line
@@ -43,12 +43,6 @@
        android:summary="@string/prefs_enable_emoji_alt_physical_key_summary"
        android:defaultValue="true"
        android:persistent="true" />
    <!-- The settings for showing setup wizard application icon shouldn't be persistent and
         the default value is added programmatically. -->
    <CheckBoxPreference
        android:key="pref_show_setup_wizard_icon"
        android:title="@string/show_setup_wizard_icon"
        android:summary="@string/show_setup_wizard_icon_summary" />
    <!-- title will be set programmatically to embed application name -->
    <CheckBoxPreference
        android:key="pref_enable_metrics_logging"
+14 −27
Original line number Diff line number Diff line
@@ -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);
    }
}
+0 −13
Original line number Diff line number Diff line
@@ -23,12 +23,10 @@ import android.media.AudioManager;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.TwoStatePreference;

import com.android.inputmethod.latin.AudioAndHapticFeedbackManager;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.define.ProductionFlags;
import com.android.inputmethod.latin.setup.LauncherIconVisibilityManager;

/**
 * "Advanced" settings sub screen.
@@ -89,10 +87,6 @@ public final class AdvancedSettingsFragment extends SubScreenFragment {
                    Settings.readKeyPreviewPopupEnabled(prefs, res));
        }

        if (!res.getBoolean(R.bool.config_setup_wizard_available)) {
            removePreference(Settings.PREF_SHOW_SETUP_WIZARD_ICON);
        }

        // If metrics logging isn't supported, or account sign in is enabled
        // don't show the logging preference.
        // TODO: Eventually when we enable account sign in by default,
@@ -121,11 +115,6 @@ public final class AdvancedSettingsFragment extends SubScreenFragment {
    public void onResume() {
        super.onResume();
        final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
        final TwoStatePreference showSetupWizardIcon =
                (TwoStatePreference)findPreference(Settings.PREF_SHOW_SETUP_WIZARD_ICON);
        if (showSetupWizardIcon != null) {
            showSetupWizardIcon.setChecked(Settings.readShowSetupWizardIcon(prefs, getActivity()));
        }
        updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
    }

@@ -135,8 +124,6 @@ public final class AdvancedSettingsFragment extends SubScreenFragment {
        if (key.equals(Settings.PREF_POPUP_ON)) {
            setPreferenceEnabled(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY,
                    Settings.readKeyPreviewPopupEnabled(prefs, res));
        } else if (key.equals(Settings.PREF_SHOW_SETUP_WIZARD_ICON)) {
            LauncherIconVisibilityManager.updateSetupWizardIconVisibility(getActivity());
        }
        updateListPreferenceSummaryToCurrentValue(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
        refreshEnablingsOfKeypressSoundAndVibrationSettings();
Loading