Skip to content
Commit c76ea600 authored by Michael Groover's avatar Michael Groover
Browse files

Resolve NPE and unexpected error code in AccountManagerServiceTest

ag/3915086 modified AccountManagerService to use the PackageManagerInternal returned from
LocalServices. However when AccountManagerServiceTest runs tests against AccountManagerService
it is using a local instance of the object which does not have access to system's local
PackageManagerInternal. To resolve this a mock PackageManagerInternal is added to the LocalServices
with a mocked hasSignatureCapability that returns an appropriate response based on the test. This
fix also exposed an issue that appears to be introduced by ag/2959363; with the change in
checkKeyIntent to no longer throw a SecurityException the expected return code for error paths
is now AccountManager.ERROR_CODE_REMOTE_EXCEPTION.

A small change was also added to AccountsDbTest to skip testCeNotAvailableInitially on eng builds
as the Log.wtf would crash the test process when invoked on eng builds.

Test: adb shell am instrument -w -e package com.android.server.accounts \
      com.android.frameworks.servicestests/\
      android.support.test.runner.AndroidJUnitRunner
Bug: 80380639

Change-Id: I9438550d1c19cc86ec56991da766d71e068784ab
parent 37e17e93
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment