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

--HG--
extra : rebase_source : b269ce3c41f7a998193972afb31183a61d3948be
This commit is contained in:
Masayuki Nakano 2018-06-19 21:00:01 +09:00
Родитель b3ebeebc31
Коммит d7023e18b8
2 изменённых файлов: 45 добавлений и 0 удалений

Просмотреть файл

@ -1732,6 +1732,25 @@ browser.errors:
record_in_processes: record_in_processes:
- 'main' - '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. # The following section contains memory reporter counters.
memoryreporter: memoryreporter:
max_ghost_windows: max_ghost_windows:

Просмотреть файл

@ -18,6 +18,7 @@
#include "mozilla/AutoRestore.h" #include "mozilla/AutoRestore.h"
#include "mozilla/Logging.h" #include "mozilla/Logging.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TextEventDispatcher.h" #include "mozilla/TextEventDispatcher.h"
#include "mozilla/TextEvents.h" #include "mozilla/TextEvents.h"
#include "mozilla/WindowsVersion.h" #include "mozilla/WindowsVersion.h"
@ -1562,6 +1563,31 @@ TSFStaticSink::OnActivated(DWORD dwProfileType,
mIsIMM_IME = IsIMM_IME(hkl); mIsIMM_IME = IsIMM_IME(hkl);
GetTIPDescription(rclsid, mLangID, guidProfile, GetTIPDescription(rclsid, mLangID, guidProfile,
mActiveTIPKeyboardDescription); 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. // Notify IMEHandler of changing active keyboard layout.
IMEHandler::OnKeyboardLayoutChanged(); IMEHandler::OnKeyboardLayoutChanged();
} }