Bug 1215818 - part 1: Add telemetry probe to collect TIP names of TSF which are actually used by the users r?jimm, m_kato
We always struggle with a lot of IME bugs on Windows. Currently, any IME
vendors should've already released TIP for TSF rather than legacy IMM-IME
since IMM-IME is not available on UWP apps. Additionally, due to API
limitation, it's difficult to get human-friendly name of IMM-IME. So, let's
collect only TIP names of TSF on Windows. This must be enough.
Note that we cannot get common-English name even though the API to retrieve
TIP name taking language code. Therefore, a TIP may be collected with
different name, e.g., one is Japanese name and the other is English name.
If we collect GUIDs of TIP, we can avoid this issue. However, it's
difficult to collect both GUID and human-friendly name since Telemetry
key is up to 72 characters.
Currently, I give up to avoid this duplicated issue. Perhaps, this is not
so serious issue since most TIP users must match language of TIP and their
system language settings. Therefore, this patch collects Locale ID of
TIP and description of it. Locale ID is necessary because some TIPs may be
named same name for different languages. For example, both Japanese and
Hangul IMEs of Microsoft are named as "Microsoft IME".
MozReview-Commit-ID: IeSxfeqS62a
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -1727,16 +1727,35 @@ browser.errors:
expires: "64"
kind: uint
notification_emails:
- nightly-js-errors@mozilla.com
- mkelly@mozilla.com
record_in_processes:
- 'main'
+widget:
+ ime_name_on_windows:
+ bug_numbers:
+ - 1215818
+ description: >
+ Locale ID and name of IME which was selected by users on Windows. This
+ does NOT collect legacy IMM-IME names since we cannot get readable names
+ and we do not support IMM-IME so aggressively because IME vendors
+ should've already released TIP for TSF for supporting Windows 8 or later
+ completely.
+ keyed: true
+ expires: never
+ kind: boolean
+ notification_emails:
+ - mnakano@mozilla.com
+ release_channel_collection: opt-out
+ record_in_processes:
+ - 'main'
+
# The following section contains memory reporter counters.
memoryreporter:
max_ghost_windows:
bug_numbers:
- 1454724
description: >
The maximum number of leaked ghost windows seen.
expires: "66"
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -13,16 +13,17 @@
#include "IMMHandler.h"
#include "KeyboardLayout.h"
#include "WinIMEHandler.h"
#include "WinUtils.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/Logging.h"
#include "mozilla/Preferences.h"
+#include "mozilla/Telemetry.h"
#include "mozilla/TextEventDispatcher.h"
#include "mozilla/TextEvents.h"
#include "mozilla/WindowsVersion.h"
#include "nsIXULRuntime.h"
#include "nsWindow.h"
#include "nsPrintfCString.h"
namespace mozilla {
@@ -1558,16 +1559,41 @@ TSFStaticSink::OnActivated(DWORD dwProfi
(dwProfileType == TF_PROFILETYPE_KEYBOARDLAYOUT ||
catid == GUID_TFCAT_TIP_KEYBOARD)) {
mOnActivatedCalled = true;
mActiveTIPGUID = guidProfile;
mLangID = langid;
mIsIMM_IME = IsIMM_IME(hkl);
GetTIPDescription(rclsid, mLangID, guidProfile,
mActiveTIPKeyboardDescription);
+ if (mActiveTIPGUID != GUID_NULL) {
+ // key should be "LocaleID|Description". Although GUID of the
+ // profile is unique key since description may be localized for system
+ // language, unfortunately, it's too long to record as key with its
+ // description. Therefore, we should record only the description with
+ // LocaleID because Microsoft IME may not include language information.
+ // 72 is kMaximumKeyStringLength in TelemetryScalar.cpp
+ nsAutoString key;
+ key.AppendPrintf("0x%04X|", mLangID & 0xFFFF);
+ nsAutoString description(mActiveTIPKeyboardDescription);
+ static const uint32_t kMaxDescriptionLength = 72 - key.Length();
+ if (description.Length() > kMaxDescriptionLength) {
+ if (NS_IS_LOW_SURROGATE(description[kMaxDescriptionLength - 1]) &&
+ NS_IS_HIGH_SURROGATE(description[kMaxDescriptionLength - 2])) {
+ description.Truncate(kMaxDescriptionLength - 2);
+ } else {
+ description.Truncate(kMaxDescriptionLength - 1);
+ }
+ // U+2026 is "..."
+ description.Append(char16_t(0x2026));
+ }
+ key.Append(description);
+ Telemetry::ScalarSet(Telemetry::ScalarID::WIDGET_IME_NAME_ON_WINDOWS,
+ key, true);
+ }
// Notify IMEHandler of changing active keyboard layout.
IMEHandler::OnKeyboardLayoutChanged();
}
MOZ_LOG(sTextStoreLog, LogLevel::Info,
("0x%p TSFStaticSink::OnActivated(dwProfileType=%s (0x%08X), "
"langid=0x%08X, rclsid=%s, catid=%s, guidProfile=%s, hkl=0x%08X, "
"dwFlags=0x%08X (TF_IPSINK_FLAG_ACTIVE: %s)), mIsIMM_IME=%s, "
"mActiveTIPDescription=\"%s\"",