Commit c9a79bfe authored by Adam Barth's avatar Adam Barth

Merge pull request #48 from jeffallen/no-run-as

Avoid use of run-as
parents 45408d3e c8c2d23f
...@@ -688,16 +688,8 @@ class AndroidDevice extends Device { ...@@ -688,16 +688,8 @@ class AndroidDevice extends Device {
return false; return false;
} }
String _getDeviceDataPath(ApplicationPackage app) {
return '/data/data/${app.id}';
}
String _getDeviceSha1Path(ApplicationPackage app) { String _getDeviceSha1Path(ApplicationPackage app) {
return '${_getDeviceDataPath(app)}/${app.name}.sha1'; return '/data/local/tmp/sky.${app.id}.sha1';
}
String _getDeviceBundlePath(ApplicationPackage app) {
return '${_getDeviceDataPath(app)}/dev.flx';
} }
String _getDeviceApkSha1(ApplicationPackage app) { String _getDeviceApkSha1(ApplicationPackage app) {
...@@ -743,7 +735,6 @@ class AndroidDevice extends Device { ...@@ -743,7 +735,6 @@ class AndroidDevice extends Device {
print('Installing ${app.name} on device.'); print('Installing ${app.name} on device.');
runCheckedSync(adbCommandForDevice(['install', '-r', app.localPath])); runCheckedSync(adbCommandForDevice(['install', '-r', app.localPath]));
runCheckedSync(adbCommandForDevice(['shell', 'run-as', app.id, 'chmod', '777', _getDeviceDataPath(app)]));
runCheckedSync(adbCommandForDevice(['shell', 'echo', '-n', _getSourceSha1(app), '>', _getDeviceSha1Path(app)])); runCheckedSync(adbCommandForDevice(['shell', 'echo', '-n', _getSourceSha1(app), '>', _getDeviceSha1Path(app)]));
return true; return true;
} }
...@@ -764,13 +755,11 @@ class AndroidDevice extends Device { ...@@ -764,13 +755,11 @@ class AndroidDevice extends Device {
_forwardObservatoryPort(); _forwardObservatoryPort();
String deviceTmpPath = '/data/local/tmp/dev.flx'; String deviceTmpPath = '/data/local/tmp/dev.flx';
String deviceBundlePath = _getDeviceBundlePath(apk);
runCheckedSync(adbCommandForDevice(['push', bundlePath, deviceTmpPath])); runCheckedSync(adbCommandForDevice(['push', bundlePath, deviceTmpPath]));
runCheckedSync(adbCommandForDevice(['shell', 'mv', deviceTmpPath, deviceBundlePath]));
List<String> cmd = adbCommandForDevice([ List<String> cmd = adbCommandForDevice([
'shell', 'am', 'start', 'shell', 'am', 'start',
'-a', 'android.intent.action.RUN', '-a', 'android.intent.action.RUN',
'-d', deviceBundlePath, '-d', deviceTmpPath,
]); ]);
if (checked) if (checked)
cmd.addAll(['--ez', 'enable-checked-mode', 'true']); cmd.addAll(['--ez', 'enable-checked-mode', 'true']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment