Diagnostics: enable split modifier keyboard in diagnostics app.
Enable keyboard diagnostics in app if the corresponding cros_config has value (`bottom_left_layout` and `bottom_right_layout`). example screenshots: https://screenshot.googleplex.com/9VrrENfTUKWjpQe.png https://screenshot.googleplex.com/7u96cWqeyCg7Qsh.png Bug: 380002430 TEST: ash_unittests and browser_tests --gtest_filter="Diagnostics*" Change-Id: Ia4f17930e718bd9634bf5e5b3f47c2cbfc3acb4c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6109418 Reviewed-by: Xiangdong Kong <xiangdongkong@google.com> Reviewed-by: Denny Huang <dennyh@google.com> Commit-Queue: Hsincheng Hou <dihimono@google.com> Cr-Commit-Position: refs/heads/main@{#1401070}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
3db385889e
commit
3d34cc1285
ash/webui
common
diagnostics_ui
18
ash/webui/common/resources/keyboard_diagram.d.ts
vendored
18
ash/webui/common/resources/keyboard_diagram.d.ts
vendored
@ -14,6 +14,7 @@ export enum PhysicalLayout {
|
||||
CHROME_OS = 'chrome-os',
|
||||
CHROME_OS_DELL_ENTERPRISE_WILCO = 'dell-enterprise-wilco',
|
||||
CHROME_OS_DELL_ENTERPRISE_DRALLION = 'dell-enterprise-drallion',
|
||||
SPLIT_MODIFIER = 'split-modifier',
|
||||
}
|
||||
|
||||
export enum TopRightKey {
|
||||
@ -22,6 +23,23 @@ export enum TopRightKey {
|
||||
CONTROL_PANEL = 'control-panel',
|
||||
}
|
||||
|
||||
export enum BottomLeftLayout {
|
||||
THREE_KEYS = '3keys',
|
||||
FOUR_KEYS = '4keys',
|
||||
}
|
||||
|
||||
export enum BottomRightLayout {
|
||||
TWO_KEYS = '2keys',
|
||||
THREE_KEYS = '3keys',
|
||||
FOUR_KEYS = '4keys',
|
||||
}
|
||||
|
||||
export enum NumberPadLayout {
|
||||
THREE_COLUMN = '3column',
|
||||
FOUR_COLUMN = '4column',
|
||||
}
|
||||
|
||||
|
||||
interface TopRowKeyInterface {
|
||||
[index: string]: {icon?: string, ariaNameI18n?: string, text?: string};
|
||||
}
|
||||
|
@ -85,6 +85,25 @@
|
||||
grid-column: span 10;
|
||||
}
|
||||
|
||||
/* Split modifier keyboard adjustments */
|
||||
|
||||
[data-physical-layout='split-modifier'] #launcherKey {
|
||||
display: none;
|
||||
}
|
||||
|
||||
[data-physical-layout='split-modifier'] #assistantKey {
|
||||
grid-column: span 4;
|
||||
}
|
||||
|
||||
[data-bottom-left-layout='4keys'] #leftAltKey {
|
||||
grid-column: span 2;
|
||||
}
|
||||
|
||||
[data-bottom-left-layout='4keys'] #leftCtrlKey {
|
||||
grid-column: span 3;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* On ISO and JIS, the Enter key is L-shaped (with the backslash key moved
|
||||
* down one row). To achieve this with elements that fit in the grid, two
|
||||
@ -204,6 +223,10 @@
|
||||
width: 77%;
|
||||
}
|
||||
|
||||
[data-show-number-pad][data-number-pad-layout='3columns'] .main-cluster {
|
||||
width: 82%;
|
||||
}
|
||||
|
||||
[data-show-number-pad] #numberPad {
|
||||
box-sizing: border-box;
|
||||
display: inline-grid;
|
||||
@ -220,6 +243,23 @@
|
||||
width: 23%;
|
||||
}
|
||||
|
||||
[data-show-number-pad][data-number-pad-layout='3columns'] #numberPad {
|
||||
box-sizing: border-box;
|
||||
display: inline-grid;
|
||||
grid-gap: var(--grid-gap);
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-template-rows: var(--rows);
|
||||
height: 100%;
|
||||
/*
|
||||
* The number pad will always be on the right, even in RTL locales, so
|
||||
* disable the lint warning.
|
||||
*/
|
||||
padding-left: /* csschecker-disable-line left-right */
|
||||
calc(var(--grid-gap) * 3);
|
||||
width: 18%;
|
||||
|
||||
}
|
||||
|
||||
#numberPad keyboard-key {
|
||||
grid-column: span 1;
|
||||
}
|
||||
@ -240,11 +280,15 @@
|
||||
-->
|
||||
</div>
|
||||
<div id="keyboard"
|
||||
data-show-number-pad$="[[showNumberPad]]">
|
||||
data-show-number-pad$="[[showNumberPad]]"
|
||||
data-number-pad-layout$="[[numberPadLayout]]">
|
||||
<div class="main-cluster"
|
||||
data-mech-layout$="[[mechanicalLayout]]"
|
||||
data-physical-layout$="[[physicalLayout]]"
|
||||
data-show-assistant-key$="[[showAssistantKey]]"
|
||||
data-show-fn-and-globe-keys$="[[showFnAndGlobeKeys_]]">
|
||||
data-show-fn-and-globe-keys$="[[showFnAndGlobeKeys_]]"
|
||||
data-bottom-left-layout$="[[bottomLeftLayout]]"
|
||||
data-bottom-right-layout$="[[bottomRightLayout]]">
|
||||
<!--
|
||||
Most keys aren't labelled here, as their glyphs are set from the
|
||||
appropriate layout in keyboard_layouts.js. The exceptions are keys that
|
||||
@ -310,14 +354,23 @@
|
||||
<keyboard-key data-code="26"></keyboard-key>
|
||||
<keyboard-key data-code="27"></keyboard-key>
|
||||
<keyboard-key id="backslashKey" data-code="43"></keyboard-key>
|
||||
|
||||
<keyboard-key
|
||||
id="launcherKey"
|
||||
class="left"
|
||||
icon="keyboard:launcher"
|
||||
data-code="125"
|
||||
aria-name="[[i18n('keyboardDiagramAriaNameLauncher')]]">
|
||||
aria-name="[[i18n('keyboardDiagramAriaNameLauncher')]]">
|
||||
</keyboard-key>
|
||||
<template is="dom-if" if="[[isEqual_(physicalLayout, 'split-modifier')]]">
|
||||
<keyboard-key
|
||||
id="assistantKey"
|
||||
class="left"
|
||||
icon="keyboard:assistant"
|
||||
data-code="583"
|
||||
aria-name="[[i18n('keyboardDiagramAriaNameAssistant')]]"
|
||||
bottom-right-glyph="caps">
|
||||
</keyboard-key>
|
||||
</template>
|
||||
<keyboard-key data-code="30"></keyboard-key>
|
||||
<keyboard-key data-code="31"></keyboard-key>
|
||||
<keyboard-key data-code="32"></keyboard-key>
|
||||
@ -387,7 +440,18 @@
|
||||
aria-name="[[i18n('keyboardDiagramAriaNameAssistant')]]">
|
||||
</keyboard-key>
|
||||
</template>
|
||||
<keyboard-key id="leftAltKey" class="left" main-glyph="alt" data-code="56"></keyboard-key>
|
||||
<template is="dom-if" if="[[isEqual_(physicalLayout, 'split-modifier')]]">
|
||||
<keyboard-key id="fnKey" class="disabled" main-glyph="fn"></keyboard-key>
|
||||
</template>
|
||||
<template is="dom-if" if="[[isEqual_(bottomLeftLayout, '4keys')]]">
|
||||
<keyboard-key
|
||||
icon="keyboard:g-logo"
|
||||
data-code="125"
|
||||
aria-name="[[i18n('keyboardDiagramAriaNameLayoutSwitch')]]">
|
||||
</keyboard-key>
|
||||
</template>
|
||||
|
||||
<keyboard-key id="leftAltKey" main-glyph="alt" data-code="56"></keyboard-key>
|
||||
<keyboard-key
|
||||
id="jisAlphanumericKey"
|
||||
class="jis-only"
|
||||
@ -402,6 +466,19 @@
|
||||
data-code="92">
|
||||
</keyboard-key>
|
||||
<keyboard-key id="rightAltKey" main-glyph="alt" data-code="100"></keyboard-key>
|
||||
<template is="dom-if" if="[[isEqual_(bottomRightLayout, '3keys')]]">
|
||||
<keyboard-key id="fnKey" class="disabled" main-glyph="fn"></keyboard-key>
|
||||
</template>
|
||||
<template is="dom-if" if="[[isEqual_(bottomRightLayout, '4keys')]]">
|
||||
<keyboard-key
|
||||
id="layoutSwitchKey"
|
||||
icon="keyboard:layout-switch"
|
||||
data-code="584"
|
||||
aria-name="[[i18n('keyboardDiagramAriaNameLayoutSwitch')]]">
|
||||
</keyboard-key>
|
||||
<keyboard-key id="fnKey" class="disabled" main-glyph="fn"></keyboard-key>
|
||||
</template>
|
||||
|
||||
<keyboard-key id="rightCtrlKey" main-glyph="ctrl" data-code="97"></keyboard-key>
|
||||
|
||||
<div id="arrowKeyCluster">
|
||||
@ -436,32 +513,62 @@
|
||||
</keyboard-key>
|
||||
</div>
|
||||
</div>
|
||||
<div id="numberPad">
|
||||
<keyboard-key main-glyph="page up" data-code="104"></keyboard-key>
|
||||
<keyboard-key main-glyph="page dn" data-code="109"></keyboard-key>
|
||||
<keyboard-key main-glyph="home" data-code="102"></keyboard-key>
|
||||
<keyboard-key main-glyph="end" data-code="107"></keyboard-key>
|
||||
<template is="dom-if" if="[[!isEqual_(numberPadLayout, '3columns')]]">
|
||||
<div id="numberPad">
|
||||
<keyboard-key main-glyph="page up" data-code="104"></keyboard-key>
|
||||
<keyboard-key main-glyph="page dn" data-code="109"></keyboard-key>
|
||||
<keyboard-key main-glyph="home" data-code="102"></keyboard-key>
|
||||
<keyboard-key main-glyph="end" data-code="107"></keyboard-key>
|
||||
|
||||
<keyboard-key main-glyph="delete" data-code="111"></keyboard-key>
|
||||
<keyboard-key main-glyph="/" data-code="98"></keyboard-key>
|
||||
<keyboard-key main-glyph="*" data-code="55"></keyboard-key>
|
||||
<keyboard-key main-glyph="-" data-code="74"></keyboard-key>
|
||||
<keyboard-key main-glyph="delete" data-code="111"></keyboard-key>
|
||||
<keyboard-key main-glyph="/" data-code="98"></keyboard-key>
|
||||
<keyboard-key main-glyph="*" data-code="55"></keyboard-key>
|
||||
<keyboard-key main-glyph="-" data-code="74"></keyboard-key>
|
||||
|
||||
<keyboard-key main-glyph="7" data-code="71"></keyboard-key>
|
||||
<keyboard-key main-glyph="8" data-code="72"></keyboard-key>
|
||||
<keyboard-key main-glyph="9" data-code="73"></keyboard-key>
|
||||
<keyboard-key class="double-height" main-glyph="+" data-code="78"></keyboard-key>
|
||||
<keyboard-key main-glyph="7" data-code="71"></keyboard-key>
|
||||
<keyboard-key main-glyph="8" data-code="72"></keyboard-key>
|
||||
<keyboard-key main-glyph="9" data-code="73"></keyboard-key>
|
||||
<keyboard-key class="double-height" main-glyph="+" data-code="78"></keyboard-key>
|
||||
|
||||
<keyboard-key main-glyph="4" data-code="75"></keyboard-key>
|
||||
<keyboard-key main-glyph="5" data-code="76"></keyboard-key>
|
||||
<keyboard-key main-glyph="6" data-code="77"></keyboard-key>
|
||||
<keyboard-key main-glyph="4" data-code="75"></keyboard-key>
|
||||
<keyboard-key main-glyph="5" data-code="76"></keyboard-key>
|
||||
<keyboard-key main-glyph="6" data-code="77"></keyboard-key>
|
||||
|
||||
<keyboard-key main-glyph="1" data-code="79"></keyboard-key>
|
||||
<keyboard-key main-glyph="2" data-code="80"></keyboard-key>
|
||||
<keyboard-key main-glyph="3" data-code="81"></keyboard-key>
|
||||
<keyboard-key class="double-height" main-glyph="enter" data-code="96"></keyboard-key>
|
||||
<keyboard-key main-glyph="1" data-code="79"></keyboard-key>
|
||||
<keyboard-key main-glyph="2" data-code="80"></keyboard-key>
|
||||
<keyboard-key main-glyph="3" data-code="81"></keyboard-key>
|
||||
<keyboard-key class="double-height" main-glyph="enter" data-code="96"></keyboard-key>
|
||||
|
||||
<keyboard-key class="double-width" main-glyph="0" data-code="82"></keyboard-key>
|
||||
<keyboard-key main-glyph="." data-code="83"></keyboard-key>
|
||||
</div>
|
||||
</template>
|
||||
<template is="dom-if" if="[[isEqual_(numberPadLayout, '3columns')]]">
|
||||
<div id="numberPad">
|
||||
<keyboard-key main-glyph="/" data-code="98"></keyboard-key>
|
||||
<keyboard-key main-glyph="*" data-code="55"></keyboard-key>
|
||||
<keyboard-key class="disabled"></keyboard-key>
|
||||
|
||||
<keyboard-key main-glyph="-" data-code="74"></keyboard-key>
|
||||
<keyboard-key main-glyph="+" data-code="78"></keyboard-key>
|
||||
<keyboard-key main-glyph="numlock" data-code="144"></keyboard-key>
|
||||
|
||||
<keyboard-key main-glyph="7" data-code="71"></keyboard-key>
|
||||
<keyboard-key main-glyph="8" data-code="72"></keyboard-key>
|
||||
<keyboard-key main-glyph="9" data-code="73"></keyboard-key>
|
||||
|
||||
<keyboard-key main-glyph="4" data-code="75"></keyboard-key>
|
||||
<keyboard-key main-glyph="5" data-code="76"></keyboard-key>
|
||||
<keyboard-key main-glyph="6" data-code="77"></keyboard-key>
|
||||
|
||||
<keyboard-key main-glyph="1" data-code="79"></keyboard-key>
|
||||
<keyboard-key main-glyph="2" data-code="80"></keyboard-key>
|
||||
<keyboard-key main-glyph="3" data-code="81"></keyboard-key>
|
||||
|
||||
<keyboard-key main-glyph="0" data-code="82"></keyboard-key>
|
||||
<keyboard-key main-glyph="." data-code="83"></keyboard-key>
|
||||
<keyboard-key main-glyph="enter" data-code="96"></keyboard-key>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<keyboard-key class="double-width" main-glyph="0" data-code="82"></keyboard-key>
|
||||
<keyboard-key main-glyph="." data-code="83"></keyboard-key>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -39,6 +39,7 @@ export const PhysicalLayout = {
|
||||
CHROME_OS: 'chrome-os',
|
||||
CHROME_OS_DELL_ENTERPRISE_WILCO: 'dell-enterprise-wilco',
|
||||
CHROME_OS_DELL_ENTERPRISE_DRALLION: 'dell-enterprise-drallion',
|
||||
SPLIT_MODIFIER: 'split-modifier',
|
||||
};
|
||||
|
||||
/**
|
||||
@ -51,6 +52,34 @@ export const TopRightKey = {
|
||||
CONTROL_PANEL: 'control-panel',
|
||||
};
|
||||
|
||||
/**
|
||||
* Enum of bottom left functional keys layout.
|
||||
* @enum {string}
|
||||
*/
|
||||
export const BottomLeftLayout = {
|
||||
THREE_KEYS: '3keys',
|
||||
FOUR_KEYS: '4keys',
|
||||
};
|
||||
|
||||
/**
|
||||
* Enum of bottom right functional keys layout.
|
||||
* @enum {string}
|
||||
*/
|
||||
export const BottomRightLayout = {
|
||||
TWO_KEYS: '2keys',
|
||||
THREE_KEYS: '3keys',
|
||||
FOUR_KEYS: '4keys',
|
||||
};
|
||||
|
||||
/**
|
||||
* Enum of number pad layout.
|
||||
* @enum {string}
|
||||
*/
|
||||
export const NumberPadLayout = {
|
||||
THREE_COLUMN: '3columns',
|
||||
FOUR_COLUMN: '4columns',
|
||||
};
|
||||
|
||||
/**
|
||||
* Enum of action keys to be shown on the top row.
|
||||
* @enum {!Object<string,
|
||||
@ -135,6 +164,12 @@ export const TopRowKey = {
|
||||
icon: 'keyboard:screen-mirror',
|
||||
ariaNameI18n: 'keyboardDiagramAriaNameScreenMirror',
|
||||
},
|
||||
kAccessibility: {
|
||||
icon: 'keyboard:accessibility',
|
||||
},
|
||||
kDictation: {
|
||||
icon: 'keyboard:dictation',
|
||||
},
|
||||
// TODO(crbug.com/1207678): work out the localization scheme for keys like
|
||||
// delete and unknown.
|
||||
kDelete: {text: 'delete'},
|
||||
|
@ -80,6 +80,9 @@
|
||||
<g id="volume-down"><path d="M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z"></g>
|
||||
<g id="volume-mute"><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51C20.63 14.91 21 13.5 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3L3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06c1.38-.31 2.63-.95 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4L9.91 6.09 12 8.18V4z"></g>
|
||||
<g id="volume-up"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"></g>
|
||||
<g id="accessibility"><path d="M9.99986 5.08337C10.4626 5.07903 10.9052 4.89326 11.2325 4.566C11.5597 4.23875 11.7455 3.79615 11.7499 3.33337C11.7512 3.04499 11.6813 2.76075 11.5463 2.50593C11.4113 2.2511 11.2154 2.03359 10.976 1.87273C10.7367 1.71188 10.4613 1.61266 10.1743 1.58391C9.8874 1.55516 9.5978 1.59777 9.33129 1.70795C9.06479 1.81812 8.82964 1.99245 8.64677 2.21542C8.46389 2.4384 8.33895 2.70311 8.28306 2.98603C8.22717 3.26894 8.24206 3.56127 8.3264 3.83704C8.41075 4.11281 8.56194 4.36346 8.76653 4.5667C8.92529 4.73331 9.11684 4.86523 9.3291 4.95415C9.54137 5.04307 9.76975 5.08707 9.99986 5.08337ZM17.1666 5C16.0351 5.30177 14.8815 5.51355 13.7166 5.63333C12.4808 5.74135 11.24 5.7803 9.9999 5.75C8.79161 5.74893 7.58427 5.68217 6.38323 5.55C5.22057 5.45758 4.067 5.27368 2.93324 5H2.8499L2.3999 6.66667C3.25512 6.9134 4.12305 7.11369 4.9999 7.26667C5.83323 7.4 6.66657 7.5 7.46657 7.58333V18.4167H9.2999V13.4167H10.7999V18.4167H12.6332V7.58333C13.4499 7.5 14.2999 7.4 15.0999 7.26667C15.9304 7.13656 16.7537 6.96411 17.5666 6.75H17.6499L17.1666 5Z"></path></g>
|
||||
<g id="dictation"><path xmlns="http://www.w3.org/2000/svg" d="M9.63018 2.0835V3.91683H17.1302V17.0835H7.29685V15.4168H5.46351V18.9168H18.9635V2.0835H9.63018ZM6.38019 8.83349C6.59953 8.83475 6.81697 8.79271 7.02003 8.70977C7.2231 8.62683 7.40779 8.50462 7.56352 8.35015C7.71799 8.19442 7.8402 8.00973 7.92314 7.80666C8.00608 7.6036 8.04812 7.38616 8.04685 7.16682V3.83349C8.04812 3.61414 8.00608 3.3967 7.92314 3.19364C7.8402 2.99058 7.71799 2.80589 7.56352 2.65015C7.40779 2.49568 7.2231 2.37347 7.02003 2.29053C6.81697 2.20759 6.59953 2.16555 6.38019 2.16682C6.16005 2.15968 5.94088 2.19903 5.73699 2.28231C5.53309 2.3656 5.34904 2.49094 5.19685 2.65015C5.04238 2.80589 4.92018 2.99058 4.83723 3.19364C4.75429 3.3967 4.71225 3.61414 4.71352 3.83349V7.16682C4.71225 7.38616 4.75429 7.6036 4.83723 7.80666C4.92018 8.00973 5.04238 8.19442 5.19685 8.35015C5.35259 8.50462 5.53728 8.62683 5.74034 8.70977C5.9434 8.79271 6.16084 8.83475 6.38019 8.83349M8.88019 13.8335H15.5469V15.5001H8.88019V13.8335ZM15.5469 11.3335H10.5469V13.0001H15.5469V11.3335ZM7.29685 11.7335V13.9168H5.46352L5.43019 11.7335C4.38412 11.5427 3.4394 10.9877 2.76352 10.1668C2.0882 9.31622 1.73941 8.25212 1.78019 7.16681H3.61352C3.60949 7.53778 3.67965 7.90581 3.8199 8.24927C3.96015 8.59273 4.16764 8.90469 4.43019 9.16681C4.69034 9.43313 5.00156 9.64421 5.34522 9.7874C5.68888 9.93059 6.0579 10.0029 6.43019 10.0001C6.80275 10.0049 7.17235 9.93341 7.51628 9.79011C7.86022 9.6468 8.17122 9.43469 8.43019 9.16681C8.69807 8.90784 8.91018 8.59684 9.05349 8.25291C9.19679 7.90897 9.26827 7.53937 9.26352 7.16681H11.0969C11.0957 8.27121 10.6929 9.33749 9.96352 10.1668C9.28209 10.9812 8.33992 11.5347 7.29685 11.7335Z"></path></g>
|
||||
<g id="g-logo"><path d="M10.151 16.2131C9.3458 16.2141 8.54882 16.0517 7.80826 15.7357C6.3193 15.1283 5.12487 13.9657 4.47742 12.4937C4.16226 11.7373 4 10.926 4 10.1066C4 9.28717 4.16226 8.47586 4.47742 7.71948C5.12487 6.24748 6.3193 5.0849 7.80826 4.47746C9.26728 3.86889 10.9038 3.84109 12.3826 4.39975C13.0831 4.68229 13.7293 5.08425 14.2923 5.58774L12.5492 7.28647C12.2246 6.99057 11.8482 6.75719 11.4389 6.5981C10.7797 6.34923 10.0624 6.29755 9.37431 6.44935C8.68627 6.60116 8.05726 6.94989 7.564 7.45301C6.88124 8.16775 6.50024 9.11815 6.50024 10.1066C6.50024 11.095 6.88124 12.0454 7.564 12.7602C7.89644 13.1152 8.29907 13.3972 8.74633 13.5884C9.19358 13.7795 9.6757 13.8756 10.1621 13.8704C10.9623 13.886 11.7445 13.6318 12.3826 13.1487C12.9797 12.6986 13.378 12.0335 13.4929 11.2946H10.1621V8.9963H15.8689C15.8689 9.22946 15.9577 9.44042 15.991 9.62916C16.003 9.83254 16.003 10.0364 15.991 10.2398C16.0246 11.0281 15.9005 11.8152 15.6259 12.5549C15.3514 13.2947 14.932 13.9722 14.3922 14.5477C13.8392 15.1039 13.1766 15.5392 12.4465 15.8259C11.7164 16.1125 10.9347 16.2444 10.151 16.2131Z"></path></g>
|
||||
</defs>
|
||||
</svg>
|
||||
</iron-iconset-svg>
|
||||
|
@ -587,10 +587,14 @@ void InputDataProvider::AddKeyboard(const InputDeviceInformation* device_info) {
|
||||
keyboard_helper_.ConstructKeyboard(device_info, aux_data.get());
|
||||
const bool is_internal_keyboard =
|
||||
keyboard->connection_type == mojom::ConnectionType::kInternal;
|
||||
// Don't add keyboard if internal keyboard is a split modifier keyboard.
|
||||
// Don't add keyboard if internal keyboard is a split modifier keyboard
|
||||
// and the config for bottom left/right is unknown.
|
||||
if (is_internal_keyboard &&
|
||||
IsSplitModifierKeyboard(device_info->input_device.id)) {
|
||||
return;
|
||||
if (keyboard->bottom_left_layout == mojom::BottomLeftLayout::kUnknown ||
|
||||
keyboard->bottom_right_layout == mojom::BottomRightLayout::kUnknown) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!features::IsExternalKeyboardInDiagnosticsAppEnabled() &&
|
||||
!is_internal_keyboard) {
|
||||
|
@ -8,8 +8,6 @@
|
||||
#pragma allow_unsafe_buffers
|
||||
#endif
|
||||
|
||||
#include "ash/webui/diagnostics_ui/backend/input/input_data_provider_keyboard.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <linux/input.h>
|
||||
|
||||
@ -22,10 +20,12 @@
|
||||
#include "ash/shell.h"
|
||||
#include "ash/system/diagnostics/mojom/input.mojom-shared.h"
|
||||
#include "ash/webui/diagnostics_ui/backend/input/input_data_provider.h"
|
||||
#include "ash/webui/diagnostics_ui/backend/input/input_data_provider_keyboard.h"
|
||||
#include "ash/webui/diagnostics_ui/mojom/input_data_provider.mojom-shared.h"
|
||||
#include "base/check_op.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/containers/fixed_flat_map.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "chromeos/ash/components/system/statistics_provider.h"
|
||||
@ -248,10 +248,12 @@ constexpr mojom::TopRowKey ConvertTopRowActionKeyToDiagnosticsTopRowKey(
|
||||
return mojom::TopRowKey::kPlayPause;
|
||||
case ui::TopRowActionKey::kPrivacyScreenToggle:
|
||||
return mojom::TopRowKey::kPrivacyScreenToggle;
|
||||
case ui::TopRowActionKey::kDictation:
|
||||
return mojom::TopRowKey::kDictation;
|
||||
case ui::TopRowActionKey::kAccessibility:
|
||||
return mojom::TopRowKey::kAccessibility;
|
||||
case ui::TopRowActionKey::kAllApplications:
|
||||
case ui::TopRowActionKey::kEmojiPicker:
|
||||
case ui::TopRowActionKey::kDictation:
|
||||
case ui::TopRowActionKey::kAccessibility:
|
||||
case ui::TopRowActionKey::kDoNotDisturb:
|
||||
case ui::TopRowActionKey::kUnknown:
|
||||
return mojom::TopRowKey::kUnknown;
|
||||
@ -468,6 +470,10 @@ mojom::KeyboardInfoPtr InputDataProviderKeyboard::ConstructKeyboard(
|
||||
result->has_assistant_key =
|
||||
device_info->event_device_info.HasKeyEvent(KEY_ASSISTANT);
|
||||
|
||||
result->bottom_left_layout = device_info->bottom_left_layout;
|
||||
result->bottom_right_layout = device_info->bottom_right_layout;
|
||||
result->numpad_layout = device_info->numpad_layout;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -167,6 +167,11 @@ class VivaldiKeyboardTestBase : public InputDataProviderKeyboardTest {
|
||||
ui::KeyboardCapability::DeviceType::kDeviceInternalKeyboard;
|
||||
device_information.keyboard_top_row_layout =
|
||||
ui::KeyboardCapability::KeyboardTopRowLayout::kKbdTopRowLayoutCustom;
|
||||
device_information.bottom_left_layout =
|
||||
mojom::BottomLeftLayout::kBottomLeft4Keys;
|
||||
device_information.bottom_right_layout =
|
||||
mojom::BottomRightLayout::kBottomRight2Keys;
|
||||
device_information.numpad_layout = mojom::NumpadLayout::kUnknown;
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
@ -451,6 +456,18 @@ TEST_F(HasNumpadTest, SwitchDisabled) {
|
||||
keyboard_info_->number_pad_present);
|
||||
}
|
||||
|
||||
class SplitModifierKeyboardTest : public VivaldiKeyboardTestBase {};
|
||||
TEST_F(SplitModifierKeyboardTest, CheckConfig) {
|
||||
keyboard_info_ = input_data_provider_keyboard_->ConstructKeyboard(
|
||||
&device_information, &aux_data_);
|
||||
|
||||
EXPECT_EQ(mojom::BottomLeftLayout::kBottomLeft4Keys,
|
||||
keyboard_info_->bottom_left_layout);
|
||||
EXPECT_EQ(mojom::BottomRightLayout::kBottomRight2Keys,
|
||||
keyboard_info_->bottom_right_layout);
|
||||
EXPECT_EQ(mojom::NumpadLayout::kUnknown, keyboard_info_->numpad_layout);
|
||||
}
|
||||
|
||||
class RevenBoardTest : public VivaldiKeyboardTestBase {};
|
||||
TEST_F(RevenBoardTest, SwitchEnabled) {
|
||||
base::CommandLine::ForCurrentProcess()->AppendSwitch(
|
||||
|
@ -904,7 +904,7 @@ TEST_F(InputDataProviderTest, GetConnectedDevices_SplitModifierKeyboard) {
|
||||
ASSERT_TRUE(future.IsReady());
|
||||
}
|
||||
|
||||
TEST_F(InputDataProviderTest, FilterOutSplitModifierKeyboard) {
|
||||
TEST_F(InputDataProviderTest, FilterOutSplitModifierKeyboardWithoutConfig) {
|
||||
base::test::ScopedFeatureList feature_list;
|
||||
feature_list.InitAndEnableFeature(features::kModifierSplit);
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "ash/shell.h"
|
||||
#include "ash/webui/diagnostics_ui/backend/input/input_data_provider.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "ui/events/ash/event_rewriter_ash.h"
|
||||
#include "ui/events/ash/keyboard_capability.h"
|
||||
#include "ui/events/devices/device_data_manager.h"
|
||||
@ -22,6 +23,42 @@ namespace ash::diagnostics {
|
||||
InputDeviceInformation::InputDeviceInformation() = default;
|
||||
InputDeviceInformation::~InputDeviceInformation() = default;
|
||||
|
||||
const std::map<std::string, mojom::BottomLeftLayout> kBottomLeftLayoutMapping =
|
||||
{
|
||||
{"keyboard_bottom_left_3_keys",
|
||||
mojom::BottomLeftLayout::kBottomLeft3Keys},
|
||||
{"keyboard_bottom_left_4_keys",
|
||||
mojom::BottomLeftLayout::kBottomLeft4Keys},
|
||||
};
|
||||
|
||||
const std::map<std::string, mojom::BottomRightLayout>
|
||||
kBottomRightLayoutMapping = {
|
||||
{"keyboard_bottom_right_2_keys",
|
||||
mojom::BottomRightLayout::kBottomRight2Keys},
|
||||
{"keyboard_bottom_right_3_keys",
|
||||
mojom::BottomRightLayout::kBottomRight3Keys},
|
||||
{"keyboard_bottom_right_4_keys",
|
||||
mojom::BottomRightLayout::kBottomRight4Keys},
|
||||
};
|
||||
|
||||
const std::map<std::string, mojom::NumpadLayout> kNumpadLayoutMapping = {
|
||||
{"numeric_pad_3_column", mojom::NumpadLayout::kNumpad3Column},
|
||||
{"numeric_pad_4_column", mojom::NumpadLayout::kNumpad4Column},
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
T GetLayoutFromFile(const base::FilePath& file_path,
|
||||
const std::map<std::string, T>& layout_mapping) {
|
||||
std::string layout_string;
|
||||
if (base::ReadFileToString(file_path, &layout_string)) {
|
||||
auto it = layout_mapping.find(layout_string);
|
||||
if (it != layout_mapping.end()) {
|
||||
return it->second;
|
||||
}
|
||||
}
|
||||
return T::kUnknown; // Default to kUnknown if file read or mapping fails
|
||||
}
|
||||
|
||||
// All blockings calls for identifying hardware need to go here: both
|
||||
// EventDeviceInfo::Initialize and ui::GetInputPathInSys can block in
|
||||
// base::MakeAbsoluteFilePath.
|
||||
@ -77,6 +114,24 @@ std::unique_ptr<InputDeviceInformation> InputDeviceInfoHelper::GetDeviceInfo(
|
||||
keyboard_capability->GetTopRowScanCodes(keyboard);
|
||||
info->keyboard_scan_codes =
|
||||
keyboard_scan_codes ? *keyboard_scan_codes : std::vector<uint32_t>();
|
||||
|
||||
// Determine bottom left layout.
|
||||
constexpr char kBottomLeftLayoutFileName[] =
|
||||
"/run/chromeos-config/v1/keyboard/bottom-left-layout";
|
||||
info->bottom_left_layout = GetLayoutFromFile(
|
||||
base::FilePath(kBottomLeftLayoutFileName), kBottomLeftLayoutMapping);
|
||||
|
||||
// Determine bottom right layout.
|
||||
constexpr char kBottomRightLayoutFileName[] =
|
||||
"/run/chromeos-config/v1/keyboard/bottom-right-layout";
|
||||
info->bottom_right_layout = GetLayoutFromFile(
|
||||
base::FilePath(kBottomRightLayoutFileName), kBottomRightLayoutMapping);
|
||||
|
||||
// Determine numpad layout.
|
||||
constexpr char kNumpadLayoutFileName[] =
|
||||
"/run/chromeos-config/v1/keyboard/numpad-layout";
|
||||
info->numpad_layout = GetLayoutFromFile(
|
||||
base::FilePath(kNumpadLayoutFileName), kNumpadLayoutMapping);
|
||||
}
|
||||
|
||||
return info;
|
||||
|
@ -14,6 +14,10 @@
|
||||
|
||||
namespace ash::diagnostics {
|
||||
|
||||
template <typename T>
|
||||
T GetLayoutFromFile(const base::FilePath& file_path,
|
||||
const std::map<std::string, T>& layout_mapping);
|
||||
|
||||
// Wrapper for tracking several pieces of information about an evdev-backed
|
||||
// device.
|
||||
class InputDeviceInformation {
|
||||
@ -33,6 +37,9 @@ class InputDeviceInformation {
|
||||
// Keyboard-only fields:
|
||||
ui::KeyboardCapability::DeviceType keyboard_type;
|
||||
ui::KeyboardCapability::KeyboardTopRowLayout keyboard_top_row_layout;
|
||||
mojom::BottomLeftLayout bottom_left_layout;
|
||||
mojom::BottomRightLayout bottom_right_layout;
|
||||
mojom::NumpadLayout numpad_layout;
|
||||
std::vector<uint32_t> keyboard_scan_codes;
|
||||
};
|
||||
|
||||
|
@ -147,10 +147,13 @@
|
||||
mechanical-layout="[[diagramMechanicalLayout]]"
|
||||
physical-layout="[[diagramPhysicalLayout]]"
|
||||
region-code="[[keyboard.regionCode]]"
|
||||
show-assistant-key="[[keyboard.hasAssistantKey]]"
|
||||
show-assistant-key="[[showAssistantKey]]"
|
||||
show-number-pad="[[showNumberPad]]"
|
||||
top-row-keys="[[topRowKeys]]"
|
||||
top-right-key="[[diagramTopRightKey]]">
|
||||
top-right-key="[[diagramTopRightKey]]"
|
||||
bottom-left-layout="[[bottomLeftLayout]]"
|
||||
bottom-right-layout="[[bottomRightLayout]]"
|
||||
number-pad-layout="[[numberPadLayout]]">
|
||||
</keyboard-diagram>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -12,7 +12,7 @@ import {getInstance} from 'chrome://resources/ash/common/cr_elements/cr_a11y_ann
|
||||
import {CrDialogElement} from 'chrome://resources/ash/common/cr_elements/cr_dialog/cr_dialog.js';
|
||||
import {CrToastElement} from 'chrome://resources/ash/common/cr_elements/cr_toast/cr_toast.js';
|
||||
import {I18nMixin} from 'chrome://resources/ash/common/cr_elements/i18n_mixin.js';
|
||||
import {KeyboardDiagramElement, MechanicalLayout as DiagramMechanicalLayout, PhysicalLayout as DiagramPhysicalLayout, TopRightKey as DiagramTopRightKey, TopRowKey as DiagramTopRowKey} from 'chrome://resources/ash/common/keyboard_diagram.js';
|
||||
import {BottomLeftLayout as DiagramBottomLeftLayout, BottomRightLayout as DiagramBottomRightLayout, KeyboardDiagramElement, MechanicalLayout as DiagramMechanicalLayout, NumberPadLayout as DiagramNumberPadLayout, PhysicalLayout as DiagramPhysicalLayout, TopRightKey as DiagramTopRightKey, TopRowKey as DiagramTopRowKey} from 'chrome://resources/ash/common/keyboard_diagram.js';
|
||||
import {KeyboardKeyState} from 'chrome://resources/ash/common/keyboard_key.js';
|
||||
import {loadTimeData} from 'chrome://resources/ash/common/load_time_data.m.js';
|
||||
import {assert} from 'chrome://resources/js/assert.js';
|
||||
@ -20,7 +20,7 @@ import {EventTracker} from 'chrome://resources/js/event_tracker.js';
|
||||
import {PolymerElementProperties} from 'chrome://resources/polymer/v3_0/polymer/interfaces.js';
|
||||
import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
|
||||
|
||||
import {KeyboardInfo, MechanicalLayout, NumberPadPresence, PhysicalLayout, TopRightKey, TopRowKey} from './input.mojom-webui.js';
|
||||
import {BottomLeftLayout, BottomRightLayout, KeyboardInfo, MechanicalLayout, NumberPadPresence, NumpadLayout, PhysicalLayout, TopRightKey, TopRowKey} from './input.mojom-webui.js';
|
||||
import {InputDataProviderInterface, KeyboardObserverReceiver, KeyEvent, KeyEventType} from './input_data_provider.mojom-webui.js';
|
||||
import {getTemplate} from './keyboard_tester.html.js';
|
||||
import {getInputDataProvider} from './mojo_interface_provider.js';
|
||||
@ -79,6 +79,8 @@ const topRowKeyMap: {[index: number]: KeyboardDiagramTopRowKey} = {
|
||||
[TopRowKey.kPreviousTrack]: DiagramTopRowKey['kPreviousTrack'],
|
||||
[TopRowKey.kPlayPause]: DiagramTopRowKey['kPlayPause'],
|
||||
[TopRowKey.kScreenMirror]: DiagramTopRowKey['kScreenMirror'],
|
||||
[TopRowKey.kAccessibility]: DiagramTopRowKey['kAccessibility'],
|
||||
[TopRowKey.kDictation]: DiagramTopRowKey['kDictation'],
|
||||
[TopRowKey.kDelete]: DiagramTopRowKey['kDelete'],
|
||||
[TopRowKey.kUnknown]: DiagramTopRowKey['kUnknown'],
|
||||
};
|
||||
@ -169,11 +171,31 @@ export class KeyboardTesterElement extends KeyboardTesterElementBase {
|
||||
computed: 'computeShowNumberPad(keyboard)',
|
||||
},
|
||||
|
||||
showAssistantKey: {
|
||||
type: Boolean,
|
||||
computed: 'computeShowAssistantKey(keyboard)',
|
||||
},
|
||||
|
||||
topRowKeys: {
|
||||
type: Array,
|
||||
computed: 'computeTopRowKeys(keyboard)',
|
||||
},
|
||||
|
||||
bottomLeftLayout: {
|
||||
type: String,
|
||||
computed: 'computeBottomLeftLayout(keyboard)',
|
||||
},
|
||||
|
||||
bottomRightLayout: {
|
||||
type: String,
|
||||
computed: 'computeBottomRightLayout(keyboard)',
|
||||
},
|
||||
|
||||
numberPadLayout: {
|
||||
type: String,
|
||||
computed: 'computeNumberPadLayout(keyboard)',
|
||||
},
|
||||
|
||||
isLoggedIn: {
|
||||
type: Boolean,
|
||||
value: loadTimeData.getBoolean('isLoggedIn'),
|
||||
@ -245,6 +267,10 @@ export class KeyboardTesterElement extends KeyboardTesterElementBase {
|
||||
if (!keyboardInfo) {
|
||||
return null;
|
||||
}
|
||||
if (keyboardInfo.bottomLeftLayout !== BottomLeftLayout.kUnknown &&
|
||||
keyboardInfo.bottomRightLayout !== BottomRightLayout.kUnknown) {
|
||||
return DiagramPhysicalLayout.SPLIT_MODIFIER;
|
||||
}
|
||||
return {
|
||||
[PhysicalLayout.kUnmappedEnumField]: null,
|
||||
[PhysicalLayout.kUnknown]: null,
|
||||
@ -272,9 +298,15 @@ export class KeyboardTesterElement extends KeyboardTesterElementBase {
|
||||
|
||||
private computeShowNumberPad(keyboard?: KeyboardInfo): boolean {
|
||||
return !!keyboard &&
|
||||
keyboard.numberPadPresent === NumberPadPresence.kPresent;
|
||||
(keyboard.numberPadPresent === NumberPadPresence.kPresent ||
|
||||
!!keyboard.numpadLayout);
|
||||
}
|
||||
|
||||
private computeShowAssistantKey(keyboard?: KeyboardInfo): boolean {
|
||||
return !!keyboard && keyboard.hasAssistantKey &&
|
||||
this.computeDiagramPhysicalLayout(keyboard) !==
|
||||
DiagramPhysicalLayout.SPLIT_MODIFIER;
|
||||
}
|
||||
|
||||
private computeTopRowKeys(keyboard?: KeyboardInfo):
|
||||
KeyboardDiagramTopRowKey[] {
|
||||
@ -284,6 +316,44 @@ export class KeyboardTesterElement extends KeyboardTesterElementBase {
|
||||
return keyboard.topRowKeys.map((keyId: TopRowKey) => topRowKeyMap[keyId]);
|
||||
}
|
||||
|
||||
private computeBottomLeftLayout(keyboardInfo?: KeyboardInfo):
|
||||
DiagramBottomLeftLayout|null {
|
||||
if (!keyboardInfo) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
[BottomLeftLayout.kUnknown]: null,
|
||||
[BottomLeftLayout.kBottomLeft3Keys]: DiagramBottomLeftLayout.THREE_KEYS,
|
||||
[BottomLeftLayout.kBottomLeft4Keys]: DiagramBottomLeftLayout.FOUR_KEYS,
|
||||
}[keyboardInfo.bottomLeftLayout];
|
||||
}
|
||||
|
||||
private computeBottomRightLayout(keyboardInfo?: KeyboardInfo):
|
||||
DiagramBottomRightLayout|null {
|
||||
if (!keyboardInfo) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
[BottomRightLayout.kUnknown]: null,
|
||||
[BottomRightLayout.kBottomRight2Keys]: DiagramBottomRightLayout.TWO_KEYS,
|
||||
[BottomRightLayout.kBottomRight3Keys]:
|
||||
DiagramBottomRightLayout.THREE_KEYS,
|
||||
[BottomRightLayout.kBottomRight4Keys]: DiagramBottomRightLayout.FOUR_KEYS,
|
||||
}[keyboardInfo.bottomRightLayout];
|
||||
}
|
||||
|
||||
private computeNumberPadLayout(keyboardInfo?: KeyboardInfo):
|
||||
DiagramNumberPadLayout|null {
|
||||
if (!keyboardInfo) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
[NumpadLayout.kUnknown]: null,
|
||||
[NumpadLayout.kNumpad3Column]: DiagramNumberPadLayout.THREE_COLUMN,
|
||||
[NumpadLayout.kNumpad4Column]: DiagramNumberPadLayout.FOUR_COLUMN,
|
||||
}[keyboardInfo.numpadLayout];
|
||||
}
|
||||
|
||||
protected getDescriptionLabel(): string {
|
||||
return this.i18n('keyboardTesterInstruction');
|
||||
}
|
||||
|
Reference in New Issue
Block a user