Use ActivityThread.currentApplication() for application context.
Context.getApplicationContext() might return null if the context is created with Context.createPackageContextAsUser(), as the application instance for that context won't be created. In this case we can use ActivityThread.currentApplication() directly, which does the same thing as if the context wasn't created for a specific package or user. We are only using this application context to bind to other services so it will work fine. Bug: 131356152 Test: presubmit Change-Id: Iee1ac9aa088d452dc58dd7f19edc58a3e0b791a6
Loading
Please register or sign in to comment