aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2022-08-16 19:08:18 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2022-08-16 19:08:18 +0000
commit7005e0c12f24d641da886adb4decc4f23ce51947 (patch)
tree9b27d37ecb1883198cc23bf36eccb1d7d06f2e72 /java
parenta9786e84d99f2a56b6810483009766fb7a6ee034 (diff)
parent2012c03ae73c0f9f10f3c5df51f81ce879615a21 (diff)
downloadlatinime-7005e0c12f24d641da886adb4decc4f23ce51947.tar.gz
latinime-7005e0c12f24d641da886adb4decc4f23ce51947.tar.xz
latinime-7005e0c12f24d641da886adb4decc4f23ce51947.zip
Merge "DO NOT MERGE - Merge Android 13"
Diffstat (limited to 'java')
-rw-r--r--java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java54
-rw-r--r--java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java3
2 files changed, 1 insertions, 56 deletions
diff --git a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
index 0517bc814..bdea3e919 100644
--- a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
+++ b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
@@ -19,9 +19,6 @@ package com.android.inputmethod.dictionarypack;
import android.app.DownloadManager;
import android.app.DownloadManager.Query;
import android.app.DownloadManager.Request;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
@@ -36,10 +33,7 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
-import com.android.inputmethod.compat.ConnectivityManagerCompatUtils;
-import com.android.inputmethod.compat.NotificationCompatUtils;
import com.android.inputmethod.latin.R;
-import com.android.inputmethod.latin.common.LocaleUtils;
import com.android.inputmethod.latin.makedict.FormatSpec;
import com.android.inputmethod.latin.utils.ApplicationUtils;
import com.android.inputmethod.latin.utils.DebugLogUtils;
@@ -844,54 +838,6 @@ public final class UpdateHandler {
}
/**
- * Shows the notification that informs the user a dictionary is available.
- *
- * When this notification is clicked, the dialog for downloading the dictionary
- * over a metered connection is shown.
- */
- private static void showDictionaryAvailableNotification(final Context context,
- final String clientId, final ContentValues installCandidate) {
- final String localeString = installCandidate.getAsString(MetadataDbHelper.LOCALE_COLUMN);
- final Intent intent = new Intent();
- intent.setClass(context, DownloadOverMeteredDialog.class);
- intent.putExtra(DownloadOverMeteredDialog.CLIENT_ID_KEY, clientId);
- intent.putExtra(DownloadOverMeteredDialog.WORDLIST_TO_DOWNLOAD_KEY,
- installCandidate.getAsString(MetadataDbHelper.WORDLISTID_COLUMN));
- intent.putExtra(DownloadOverMeteredDialog.SIZE_KEY,
- installCandidate.getAsInteger(MetadataDbHelper.FILESIZE_COLUMN));
- intent.putExtra(DownloadOverMeteredDialog.LOCALE_KEY, localeString);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
- final PendingIntent notificationIntent = PendingIntent.getActivity(context,
- 0 /* requestCode */, intent,
- PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_ONE_SHOT);
- final NotificationManager notificationManager =
- (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
- // None of those are expected to happen, but just in case...
- if (null == notificationIntent || null == notificationManager) return;
-
- final String language = (null == localeString) ? ""
- : LocaleUtils.constructLocaleFromString(localeString).getDisplayLanguage();
- final String titleFormat = context.getString(R.string.dict_available_notification_title);
- final String notificationTitle = String.format(titleFormat, language);
- final Notification.Builder builder = new Notification.Builder(context)
- .setAutoCancel(true)
- .setContentIntent(notificationIntent)
- .setContentTitle(notificationTitle)
- .setContentText(context.getString(R.string.dict_available_notification_description))
- .setTicker(notificationTitle)
- .setOngoing(false)
- .setOnlyAlertOnce(true)
- .setSmallIcon(R.drawable.ic_notify_dictionary);
- NotificationCompatUtils.setColor(builder,
- context.getResources().getColor(R.color.notification_accent_color));
- NotificationCompatUtils.setPriorityToLow(builder);
- NotificationCompatUtils.setVisibilityToSecret(builder);
- NotificationCompatUtils.setCategoryToRecommendation(builder);
- final Notification notification = NotificationCompatUtils.build(builder);
- notificationManager.notify(DICT_AVAILABLE_NOTIFICATION_ID, notification);
- }
-
- /**
* Installs a word list if it has never been requested.
*
* This is called when a word list is requested, and is available but not installed. It checks
diff --git a/java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java b/java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java
index 60d257362..5e6e4ab25 100644
--- a/java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java
+++ b/java/src/com/android/inputmethod/latin/AudioAndHapticFeedbackManager.java
@@ -119,8 +119,7 @@ public final class AudioAndHapticFeedbackManager {
// Go ahead with the system default
if (viewToPerformHapticFeedbackOn != null) {
viewToPerformHapticFeedbackOn.performHapticFeedback(
- HapticFeedbackConstants.KEYBOARD_TAP,
- HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
+ HapticFeedbackConstants.KEYBOARD_TAP);
}
}