1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 02:09:32 +02:00

Include an error description for failed installations.

This commit is contained in:
Simo Kinnunen 2014-09-04 16:23:25 +09:00
parent 02fb1f9add
commit 73c8e52bce
4 changed files with 50 additions and 5 deletions

View file

@ -10,6 +10,7 @@ var logger = require('../../../util/logger')
var wire = require('../../../wire')
var wireutil = require('../../../wire/util')
var promiseutil = require('../../../util/promiseutil')
var responseCodes = require('./install/response-codes')
// The error codes are available at https://github.com/android/
// platform_frameworks_base/blob/master/core/java/android/content/
@ -179,7 +180,9 @@ module.exports = syrup.serial()
)
push.send([
channel
, reply.fail(err.code)
, reply.fail(err.code, {
description: responseCodes[err.code] || null
})
])
})
.catch(function(err) {

View file

@ -0,0 +1,40 @@
{
"INSTALL_SUCCEEDED": "Installation succeeded.",
"INSTALL_FAILED_ALREADY_EXISTS": "The package is already installed.",
"INSTALL_FAILED_INVALID_APK": "The package archive file is invalid.",
"INSTALL_FAILED_INVALID_URI": "The URI passed in is invalid.",
"INSTALL_FAILED_INSUFFICIENT_STORAGE": "The package manager service found that the device didn't have enough storage space to install the app.",
"INSTALL_FAILED_DUPLICATE_PACKAGE": "A package is already installed with the same name.",
"INSTALL_FAILED_NO_SHARED_USER": "The requested shared user does not exist.",
"INSTALL_FAILED_UPDATE_INCOMPATIBLE": "A previously installed package of the same name has a different signature than the new package (and the old package's data was not removed)."
"INSTALL_FAILED_MISSING_SHARED_LIBRARY": "The new package uses a shared library that is not available.",
"INSTALL_FAILED_REPLACE_COULDNT_DELETE": "The existing package could not be deleted.",
"INSTALL_FAILED_DEXOPT": "The new package failed while optimizing and validating its dex files, either because there was not enough storage or the validation failed.",
"INSTALL_FAILED_OLDER_SDK": "The new package failed because the current SDK version is older than that required by the package.",
"INSTALL_FAILED_CONFLICTING_PROVIDER": "The new package failed because it contains a content provider with thesame authority as a provider already installed in the system.",
"INSTALL_FAILED_NEWER_SDK": "The new package failed because the current SDK version is newer than that required by the package.",
"INSTALL_FAILED_TEST_ONLY": "The new package failed because it has specified that it is a test-only package and the caller has not supplied the INSTALL_ALLOW_TEST flag.",
"INSTALL_FAILED_CPU_ABI_INCOMPATIBLE": "The package being installed contains native code, but none that is compatible with the device's CPU_ABI.",
"INSTALL_FAILED_MISSING_FEATURE": "The new package uses a feature that is not available.",
"INSTALL_FAILED_CONTAINER_ERROR": "A secure container mount point couldn't be accessed on external media.",
"INSTALL_FAILED_INVALID_INSTALL_LOCATION": "The new package couldn't be installed in the specified install location.",
"INSTALL_FAILED_MEDIA_UNAVAILABLE": "The new package couldn't be installed in the specified install location because the media is not available.",
"INSTALL_FAILED_VERIFICATION_TIMEOUT": "The new package couldn't be installed because the verification timed out.",
"INSTALL_FAILED_VERIFICATION_FAILURE": "The new package couldn't be installed because the verification did not succeed.",
"INSTALL_FAILED_PACKAGE_CHANGED": "The package changed from what the calling program expected.",
"INSTALL_FAILED_UID_CHANGED": "The new package is assigned a different UID than it previously held.",
"INSTALL_FAILED_VERSION_DOWNGRADE": "The new package has an older version code than the currently installed package.",
"INSTALL_PARSE_FAILED_NOT_APK": "The parser was given a path that is not a file, or does not end with the expected '.apk' extension.",
"INSTALL_PARSE_FAILED_BAD_MANIFEST": "The parser was unable to retrieve the AndroidManifest.xml file.",
"INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION": "The parser encountered an unexpected exception.",
"INSTALL_PARSE_FAILED_NO_CERTIFICATES": "The parser did not find any certificates in the .apk.",
"INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES": "The parser found inconsistent certificates on the files in the .apk.",
"INSTALL_PARSE_FAILED_CERTIFICATE_ENCODING": "The parser encountered a CertificateEncodingException in one of the files in the .apk.",
"INSTALL_PARSE_FAILED_BAD_PACKAGE_NAME": "The parser encountered a bad or missing package name in the manifest.",
"INSTALL_PARSE_FAILED_BAD_SHARED_USER_ID": "The parser encountered a bad shared user id name in the manifest.",
"INSTALL_PARSE_FAILED_MANIFEST_MALFORMED": "The parser encountered some structural problem in the manifest.",
"INSTALL_PARSE_FAILED_MANIFEST_EMPTY": "The parser did not find any actionable tags (instrumentation or application) in the manifest.",
"INSTALL_FAILED_INTERNAL_ERROR": "The system failed to install the package because of system issues.",
"INSTALL_FAILED_USER_RESTRICTED": "The system failed to install the package because the user is restricted from installing apps.",
"INSTALL_FAILED_NO_MATCHING_ABIS": "The system failed to install the package because its packaged native code did not match any of the ABIs supported by the system."
}

View file

@ -49,12 +49,13 @@ var wireutil = {
, body ? JSON.stringify(body) : null
))
}
, fail: function(data) {
, fail: function(data, body) {
return wireutil.envelope(new wire.TransactionDoneMessage(
source
, seq++
, false
, data || 'fail'
, body ? JSON.stringify(body) : null
))
}
, progress: function(data, progress) {

View file

@ -130,14 +130,15 @@ module.exports = function TransactionServiceFactory(socket) {
if (message.data) {
result.lastData = result.data[seq] = message.data
}
if (message.body) {
result.body = JSON.parse(message.body)
}
}
else {
result.lastData = result.error = message.data
}
if (message.body) {
result.body = JSON.parse(message.body)
}
resolver.resolve(result)
return
}