Skip to content

Commit aeb479a

Browse files
committed
Optimize the flutter-tizen run execution time
1 parent 8851345 commit aeb479a

2 files changed

Lines changed: 17 additions & 35 deletions

File tree

lib/tizen_device.dart

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,7 @@ class TizenDevice extends Device {
156156
} else if (usesSecureProtocol) {
157157
return cpuArch == 'armv7' ? 'arm' : 'arm64';
158158
} else {
159-
// Reading the cpu_arch capability value is not a reliable way to get the
160-
// runtime architecture from devices like Raspberry Pi. The following is a
161-
// little workaround.
162-
final String stdout =
163-
runSdbSync(<String>['shell', 'ls', '/usr/lib64']).stdout;
164-
return stdout.contains('No such file or directory') ? 'arm' : 'arm64';
159+
return getCapability('architecture') == '32' ? 'arm' : 'arm64';
165160
}
166161
}();
167162

@@ -184,26 +179,20 @@ class TizenDevice extends Device {
184179
}
185180

186181
Future<String?> _getDeviceAppSignature(TizenTpk app) async {
187-
final List<String> rootCandidates = <String>[
188-
'/opt/usr/apps',
189-
'/opt/usr/globalapps',
190-
];
191-
for (final String root in rootCandidates) {
192-
final File signatureFile = _fileSystem.systemTempDirectory
193-
.createTempSync()
194-
.childFile('author-signature.xml');
195-
final RunResult result = await runSdbAsync(
196-
<String>[
197-
'pull',
198-
'$root/${app.id}/${signatureFile.basename}',
199-
signatureFile.path,
200-
],
201-
checked: false,
202-
);
203-
if (result.exitCode == 0 && signatureFile.existsSync()) {
204-
final Signature? signature = Signature.parseFromXml(signatureFile);
205-
return signature?.signatureValue;
206-
}
182+
final File signatureFile = _fileSystem.systemTempDirectory
183+
.createTempSync()
184+
.childFile('author-signature.xml');
185+
final RunResult result = await runSdbAsync(
186+
<String>[
187+
'pull',
188+
'/opt/usr/home/owner/apps_rw/${app.id}/${signatureFile.basename}',
189+
signatureFile.path,
190+
],
191+
checked: false,
192+
);
193+
if (result.exitCode == 0 && signatureFile.existsSync()) {
194+
final Signature? signature = Signature.parseFromXml(signatureFile);
195+
return signature?.signatureValue;
207196
}
208197
return null;
209198
}
@@ -225,6 +214,7 @@ class TizenDevice extends Device {
225214
if (wasInstalled) {
226215
if (await isLatestBuildInstalled(app)) {
227216
_logger.printStatus('Latest build already installed.');
217+
await stopApp(app, userIdentifier: userIdentifier);
228218
return true;
229219
}
230220
}
@@ -367,11 +357,6 @@ class TizenDevice extends Device {
367357
throwToolExit('Problem building Tizen application: see above error(s).');
368358
}
369359

370-
_logger.printTrace("Stopping app '${package.name}' on $name.");
371-
if (await isAppInstalled(package)) {
372-
await stopApp(package, userIdentifier: userIdentifier);
373-
}
374-
375360
if (!await installApp(package, userIdentifier: userIdentifier)) {
376361
return LaunchResult.failed();
377362
}

test/general/tizen_device_test.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ void main() {
7575
FakeCommand(
7676
command: _sdbCommand(<String>['shell', 'app_launcher', '-l']),
7777
),
78-
FakeCommand(
79-
command: _sdbCommand(<String>['shell', 'app_launcher', '-l']),
80-
),
8178
FakeCommand(command: _sdbCommand(<String>['install', 'app.tpk'])),
8279
FakeCommand(
8380
command: _sdbCommand(<String>[
@@ -182,7 +179,7 @@ User's Application
182179
FakeCommand(
183180
command: _sdbCommand(<String>[
184181
'pull',
185-
'/opt/usr/apps/TestPackage/author-signature.xml',
182+
'/opt/usr/home/owner/apps_rw/TestPackage/author-signature.xml',
186183
'/.tmp_rand0/rand0/author-signature.xml',
187184
]),
188185
onRun: (_) {

0 commit comments

Comments
 (0)