### Question:
AppSizeUtil { @SuppressWarnings("JavaReflectionMemberAccess") private static void getAppSizeLowerO(Context context, @NonNull final OnGetSizeListener listener) { try { Method method = PackageManager.class.getMethod("getPackageSizeInfo", String.class, IPackageStatsObserver.class); method.invoke(context.getPackageManager(), context.getPackageName(), new IPackageStatsObserver.Stub() { @Override public void onGetStatsCompleted(PackageStats pStats, boolean succeeded) { AppSizeInfo ctAppSizeInfo = new AppSizeInfo(); ctAppSizeInfo.cacheSize = pStats.cacheSize; ctAppSizeInfo.dataSize = pStats.dataSize; ctAppSizeInfo.codeSize = pStats.codeSize; listener.onGetSize(ctAppSizeInfo); } }); } catch (Throwable e) { listener.onError(e); } }    }### Answer:
@Test(timeout = 5000) @Config(sdk = Build.VERSION_CODES.LOLLIPOP) public void getAppSizeLowerO() { CountDownLatch countDownLatch = new CountDownLatch(1); final AppSizeInfo[] appSizeInfo = new AppSizeInfo[1]; AppSizeUtil.getAppSize(ApplicationProvider.getApplicationContext(), new AppSizeUtil.OnGetSizeListener() { @Override public void onGetSize(AppSizeInfo ctAppSizeInfo) { countDownLatch.countDown(); appSizeInfo[0] = ctAppSizeInfo; } @Override public void onError(Throwable t) { countDownLatch.countDown(); } }); try { countDownLatch.await(3, TimeUnit.SECONDS); } catch (InterruptedException e) { Assert.fail(); } Log4Test.d(String.valueOf(appSizeInfo[0])); Assert.assertTrue(appSizeInfo[0].dataSize >= 0); Assert.assertTrue(appSizeInfo[0].codeSize >= 0); Assert.assertTrue(appSizeInfo[0].cacheSize >= 0); }