summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderThread.cpp
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2020-07-23 23:16:47 +0100
committerTobias Thierer <tobiast@google.com>2020-07-26 22:10:23 +0100
commit19a88b6d09d319280853f545ba04bcf3ca68bf02 (patch)
tree005defbfdab6ba4b9dc5ef3b75691296893ae810 /libs/hwui/renderthread/RenderThread.cpp
parent2b3004dcc1bf13106741af4464da69012de1b279 (diff)
DataChangedJournal: Disallow null files/directories.
Passing a null File into DataChangedJournal would always have thrown NPE if various methods (toString(), equals(), hashCode(), addPackage()) were called later, but by that time the origin (stacktrace) of the offending null value would have been lost. This CL changes the class to detect this error earlier, namely in the ctor. In addition, this CL changes newJournal(File journalDirectory) to not accept null; previously, if null was passed, then the journal would have been created in the wrong directory, which would then have led to incorrect behavior of listJournals: - listJournals(null) would have thrown NPE - listJournals(nonNullJournalDirectory) would not have found the journal. I convinced myself through code inspection that this error case is not currently possible, but this was not straightforward: UserBackupManagerService.mJournalDir is passed to DCJ.newJournal() from writeToJournalLocked() which is called from dataChangedImpl() which is called from mPackageTrackingReceiver, which is luckily registered only after mJournalDir was initialized fairly late in the non-test ctor); should this become buggy in future, then after this CL it should be more likely to be discovered. Bug: 162022005 Test: Manually checked no non-test callers pass in non-null. Test: atest FrameworksServicesTests:com.android.server.backup.DataChangedJournalTest Change-Id: I1756add05f3d65e455b2e61448f98ceceb5b39f1
Diffstat (limited to 'libs/hwui/renderthread/RenderThread.cpp')
0 files changed, 0 insertions, 0 deletions