For getting info mention in Question I try using hidden Api( using AIDL), it's work in Api below 26 but not in 26 or 27. in oreo it's give me this :
java.lang.UnsupportedOperationException: Shame on you for calling the hidden API getPackageSizeInfoAsUser(). Shame!
I did achive that from : http://allandroidprojects.blogspot.com/2016/06/android-get-cache-size-data-size-apk.html
this solution is accepted ans in but this will not working in oreo :
there is another solution mention in that post was :
final PackageManager pm = context.getPackageManager();
ApplicationInfo applicationInfo = pm.getApplicationInfo(appInfo.getPackage(), 0);
File file = new File(applicationInfo.publicSourceDir);
int size = file.length();
By using above method I can't get size of all app because it's give me only base apk size and not other content of app for example :
log :
2019-07-02 11:48:16.082 4069-4069/com.example.getallinstallapp D/AppSize: :com.android.cts.priv.ctsshim:6044
2019-07-02 11:48:16.098 4069-4069/com.example.getallinstallapp D/AppSize: :/system/priv-app/GoogleExtServices/GoogleExtServices.apk
2019-07-02 11:48:16.099 4069-4069/com.example.getallinstallapp D/AppSize: :Android Services Library:10924
2019-07-02 11:48:16.154 4069-4069/com.example.getallinstallapp D/AppSize: :/data/app/com.example.voicelockreenginer-nhzu_JLVE6Eh5C-sfg-asg==/base.apk
2019-07-02 11:48:16.154 4069-4069/com.example.getallinstallapp D/AppSize: :VoiceScreenLock:144984
2019-07-02 11:48:16.163 4069-4069/com.example.getallinstallapp D/AppSize: :/system/app/CubeLiveWallpapers/CubeLiveWallpapers.apk
2019-07-02 11:48:16.163 4069-4069/com.example.getallinstallapp D/AppSize: :Example Wallpapers:22868
2019-07-02 11:48:16.169 4069-4069/com.example.getallinstallapp D/AppSize: :/system/priv-app/TelephonyProvider/TelephonyProvider.apk
2019-07-02 11:48:16.169 4069-4069/com.example.getallinstallapp D/AppSize: :Phone and Messaging Storage:137053
2019-07-02 11:48:16.196 4069-4069/com.example.getallinstallapp D/AppSize: :/system/priv-app/CalendarProvider/CalendarProvider.apk
2019-07-02 11:48:16.196 4069-4069/com.example.getallinstallapp D/AppSize: :Calendar Storage:127531
2019-07-02 11:48:16.202 4069-4069/com.example.getallinstallapp D/AppSize: :/system/priv-app/MediaProvider/MediaProvider.apk
2019-07-02 11:48:16.202 4069-4069/com.example.getallinstallapp D/AppSize: :Media Storage:133272
2019-07-02 11:48:16.214 4069-4069/com.example.getallinstallapp D/AppSize: :/system/priv-app/GoogleOneTimeInitializer/GoogleOneTimeInitializer.apk
2019-07-02 11:48:16.214 4069-4069/com.example.getallinstallapp D/AppSize: :Google One Time Init:58568
2019-07-02 11:48:16.229 4069-4069/com.example.getallinstallapp D/AppSize: :/system/app/GoogleExtShared/GoogleExtShared.apk
2019-07-02 11:48:16.229 4069-4069/com.example.getallinstallapp D/AppSize: :Android Shared Library:4774
2019-07-02 11:48:16.236 4069-4069/com.example.getallinstallapp D/AppSize: :/system/priv-app/WallpaperCropper/WallpaperCropper.apk
2019-07-02 11:48:16.236 4069-4069/com.example.getallinstallapp D/AppSize: :com.android.wallpapercropper:25986
here it's give me size ofVoiceScreenLock:144984
around 144 kb but it's actual size is around 13.5 to 14 MB .
above mention method returning some right apk size as well. so for more clarity I went to Device Explorer.https://ibb.co/r2ys3ZW
As you can see for get whole app size I need combine result of all .apk in that folder.
how can I get proper App size and other info mention in question ?