Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Android at Scale
How we Automated the Configuration and
Personalization of 500 Samsung Galaxy Tabs for
the Hyundai Dealer Network
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Presentation Overview
Where it started
How we got here
Technology
The tools we used
Reflection
What would we do differently
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Where it all started
How did we get here?
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
webqem and Hyundai
Digitally enabling Australia's fastest growing automotive brand
With a focus on providing the best possible
experience to customers both before, during
and after purchase, we've helped Hyundai
implement an integrated, best-of-breed mobile
digital solution across the business.
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Accessories
The Hyundai Accessories app
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Digital Brochures
Comprehensive range of tablet publications covers every vehicle
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Handover App
Comprehensive range of tablet publications covers every vehicle
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
The Hyundai Dealer Network
The Hyundai Dealer Network
• Over 160 dealers across the country
• 5 different dealer size categories
• Dealers get a different number tablets
based on their category
• Large dealers: 5 tablets
• Mid-sized: 3 tablets
• Small: 1 tablet
Hyundai dealers in Australia
About
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Tablets
Exploring the Galaxy
• 296 Galaxy Tab S 10.5”
• 203 Galaxy Tab S 8.4”
• 75+ new tablets provisioned since
• 2 trial runs for dealer training days
Galaxy Tab S
Tablet rollout
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Worlds longest unboxing video
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Limitations
What we could and couldn’t do with the devices
• Devices will be owned by the dealers
• Warranty must be preserved
• No rooting
• No replacing the system image
• Dealers to get the full Samsung tablet
experience
• No custom launchers
Galaxy Tab S
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
The finished product
Target look and feel for all tablets
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Technology
What tools did we use?
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Technology
To achieve consistent and repeatable setups, we used a combination of
technologies
System Backups
Full backup of a “Master” tablet, with
all screens configured and apps
installed
UI Automation
Device customisations, configuring
WiFi, Timezone, Lockscreen
backgrounds
adb and adbkit
The Android Debug Bridge in
conjunction with the nodejs wrapper,
adbkit
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Multi-Technology Mix
David Pope, 2014
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
System Backups
Preparing a system backup
• Android system backups are a way of capturing an
image of your device setup
• Creates a .ab file that can then be re-applied to the
device
• Allows you to backup:
• APKs – installed applications*
• Shared - shared storage / SD card contents;
• System – include system applications
• OBB – Include apk expansion files (needed
for large apps)
• *Applications downloaded from the play store can opt out of being included in
backups
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Backup Syntax$ adb help
adb backup [-f <file>] [-apk|-noapk] [-obb|-noobb] [-shared|-noshared] [-all] [-system|-nosystem] [<packages...>]
- write an archive of the device's data to <file>.
If no -f option is supplied then the data is written
to "backup.ab" in the current directory.
(-apk|-noapk enable/disable backup of the .apks themselves
in the archive; the default is noapk.)
(-obb|-noobb enable/disable backup of any installed apk expansion
(aka .obb) files associated with each application; the default
is noobb.)
(-shared|-noshared enable/disable backup of the device's
shared storage / SD card contents; the default is noshared.)
(-all means to back up all installed applications)
(-system|-nosystem toggles whether -all automatically includes
system applications; the default is to include system apps)
(<packages...> is the list of applications to be backed up. If
the -all or -shared flags are passed, then the package
list is optional. Applications explicitly given on the
command line will be included even if -nosystem would
ordinarily cause them to be omitted.)
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Backup Syntax# Backup command we used
adb backup –f dealer-tablets.ab –apk –obb –shared –system
# Restore command
adb restore dealer-tablets.ab
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Issues with System Backups
• The backup command hangs
• Often the backup command would get stuck on shared
data
• Check the file size, it may be done
• Tablets crash while restoring
• Optimized backups unfortunately caused the tablets to
reboot
• No package restrictions
• Running the restore command twice disables the
continue button
• Try quitting the backup app
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
UI Automator
Automate everything not covered by backups
The UI Automator testing framework provides a set of APIs to build UI tests that perform
interactions on user apps and system apps.
• Tests are written in Java
• UI Tests can access any screen the user can access
• Can modify system settings
• Update user screens
• Add personalisation to each tablet
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
UIAutomator Viewer
Inspect the screen and target individual elements
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Implementing a UiAutomator test
// Extended UiAutomatorTestCase with helper methods that all our
// tests used
public abstract class AutomationTestCase extends UiAutomatorTestCase
// Working with UiObjects and UiSelectors
UiObject deviceTab = new UiObject(new UiSelector().text("Device"));
deviceTab.click();
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Implementing a UiAutomator test
// Simple test case for disabling multi window mode
if (launchSettings()) {
// Connections tab
UiObject deviceTab = new UiObject(new UiSelector().text("Device"));
deviceTab.click();
// Check if the multi window option is enabled and disable it
UiObject multiWindowToggle = new UiObject(new
UiSelector().resourceId("com.android.settings:id/header_display_multi_window").childSelector(new
UiSelector().className("android.widget.Switch")));
if (multiWindowToggle.isChecked()) {
multiWindowToggle.click();
}
}
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Implementing a UiAutomator test
Short cuts
// Launch settings app
Runtime.getRuntime().exec("am start -n com.android.settings/.Settings");
// Check the current running app
getUiDevice().getCurrentPackageName().contains("com.android.settings");
// Make sure device is unlocked
protected void unlock() throws RemoteException{
getUiDevice().sleep();
getUiDevice().wakeUp();
getUiDevice().swipe(530, 380, 1080, 38, 20);
}
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Running the testsadb shell uiautomator runtest MyFirstTest.jar -c com.webqem.WifiAutomation
# Tests can now be run via gradle
android {
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
./gradlew cC
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
What we Automated
• WiFi configuration – All devices were connected to a guest network allowing us to
correct the system time and check for updates
• Multi window mode – Disabled for all devices
• Timezone selection
• Google Play store setup (human still required for captcha)
• Device lock screen – customised message for each dealer, specific lock screen
animation and display elements
• Lock screen background
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Device Management
How to manage multiple devices at once
By utilising adb and adbkit (Github openstf/adbkit) we are able to access and configure
up to 25 devices at a time
Web browser
Dealer database
Server running with adbkit
USB HubsTablets
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Device Management
Web Interface
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Device Management
The deployment room (cupboard)
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Device Management
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Device Management
Adbkit provides wrappers for many of the adb commands
// Track devices as they are added
client.trackDevices()
.then(function(tracker) {
tracker.on('add', function(device) {
// Add to device list
})
// Push files
client.push(device, 'SettingsAutomator/bin/SettingsAutomator.jar',
'/data/local/tmp/SettingsAutomator.jar')
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Device Management
// Run a shell command
client.shell(device, command)
// Restore backup – not available in adbkit
exec('adb -s ' + device + ' restore backup/' + imageFile, callback)
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Some stats
• USB 2.0 transfer speed is 480 megabits per second
• Backup restore is limited by the adb channel transfer speed, which hangs around
1MBps
• Restoring a full backup (1GB) takes 10 minutes when running in parallel
• Possible to run more than 25 at a time (we were limited by space). We tested up to 40
tablets at a time
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
Reflection
How could we improve the process?
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
What could we do with root?
• Skip the device setup screens
• You can modify the settings db to set the device to a configured state
• Set android debug mode programatically through System.Settings
• Set lock screen images
• Do a proper backup, with full settings included
• Backups are limited without root access
• Deploy a custom rom
Copyright © 1999 - 2015 webqem pty ltd | YOW! Connected 2015
What would we change
• We would recommend getting Google Apps for Work
• Managing dealer play accounts would easier
• Private channel for distribution of internal apps
• We were originally working with an MDM provider, but did not end up rolling this
out to the dealers
• Try to achieve slimmer backups
• The process would run a lot faster with tuned backups
• Device crashes would need to be worked around
Copyright © 1999 - 2015 webqem pty ltd | Commercial in confidence
Thanks for watching