Skip to content

Commit

Permalink
Merge 0f4c7fa into 570632b
Browse files Browse the repository at this point in the history
  • Loading branch information
Mykola Mokhnach committed Jun 22, 2018
2 parents 570632b + 0f4c7fa commit 7fd5ed0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/android-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import Bootstrap from 'appium-android-bootstrap';
import B from 'bluebird';

import ADB from 'appium-adb';
import { default as unlocker, PIN_UNLOCK, PASSWORD_UNLOCK, PATTERN_UNLOCK, FINGERPRINT_UNLOCK } from './unlock-helpers';

import { default as unlocker, PIN_UNLOCK, PASSWORD_UNLOCK,
PATTERN_UNLOCK, FINGERPRINT_UNLOCK } from './unlock-helpers';

const PACKAGE_INSTALL_TIMEOUT = 90000; // milliseconds
const CHROME_BROWSER_PACKAGE_ACTIVITY = {
Expand Down Expand Up @@ -49,6 +49,7 @@ const SETTINGS_HELPER_PKG_ID = 'io.appium.settings';
const SETTINGS_HELPER_PKG_ACTIVITY = ".Settings";
const UNLOCK_HELPER_PKG_ID = 'io.appium.unlock';
const UNLOCK_HELPER_PKG_ACTIVITY = ".Unlock";
const UNICODE_IME_PKG_ID = 'io.appium.android.ime';

let helpers = {};

Expand Down Expand Up @@ -400,13 +401,19 @@ helpers.installOtherApks = async function (otherApps, adb, opts) {
helpers.initUnicodeKeyboard = async function (adb) {
logger.debug('Enabling Unicode keyboard support');
logger.debug("Pushing unicode ime to device...");
await adb.install(unicodeIMEPath, {replace: false});
try {
await adb.install(unicodeIMEPath, {replace: false});
} catch (err) {
logger.info(`Performing full reinstall of ${UNICODE_IME_PKG_ID} as a possible fix for: ${err.message}`);
await adb.uninstallApk(UNICODE_IME_PKG_ID);
await adb.install(unicodeIMEPath, {replace: false});
}

// get the default IME so we can return back to it later if we want
let defaultIME = await adb.defaultIME();

logger.debug(`Unsetting previous IME ${defaultIME}`);
const appiumIME = 'io.appium.android.ime/.UnicodeIME';
const appiumIME = `${UNICODE_IME_PKG_ID}/.UnicodeIME`;
logger.debug(`Setting IME to '${appiumIME}'`);
await adb.enableIME(appiumIME);
await adb.setIME(appiumIME);
Expand Down

0 comments on commit 7fd5ed0

Please sign in to comment.