Android sqlite behavior? - android

I have an app with complicated database structure. When I use command "adb shell dumpsys meminfo [package name]", it shows information as followings:
DATABASES
pgsz dbsz Lookaside(b) cache Dbname
4 20 41 2/1514/3 /data/user/0/[packagename]/databases/a.db
4 740 26 129/1375/2 /data/user/0/[packagename]/databases/b.db
4 64 21 0/1409/1 /data/user/0/[packagename]/databases/c.db
4 64 27 1/1408/2 /data/user/0/[packagename]/databases/c.db (3)
4 64 57 12/1411/5 /data/user/0/[packagename]/databases/c.db (2)
4 32 35 12/1514/3 /data/user/0/[packagename]/databases/d.db
4 20 28 13/1381/2 /data/user/0/[packagename]/databases/e.db
4 20 28 1/1513/2 /data/user/0/[packagename]/databases/f.db
4 16 21 0/1514/1 /data/user/0/[packagename]/databases/g.db
4 19164 84 124/1517/6 /data/user/0/[packagename]/databases/h.db
My questions are
why I get 3 c.db?
why number of middle cache value (cache miss-hit count?) are increased every seconds?
Thanks in advance!
Add:
I found out that when I using WAL mode and multiple threads to access database at the same time, it will create a lots connections until I call database.close() after accessing database. Are there any ideas how to handle it?

Related

publishToMavenLocal -Pversion does not change version

I try to change the version while publishing a android project to my local maven repository.
Simple publishing works fine with./gradlew publishToMavenLocal.
While researching I found out that it should be possible to override the version number of my maven package on executing the publishing process. But when executing for example publishToMavenLocal -Pversion="asdf" this does not change the version in anyway. it seems like it is ignored.
I got the idea of the -Pversion flag from the comments of this post
Furthermore also the gradle docs say that it should be possible to override the version in some way when building it:
Overriding the default identity values is easy: simply specify the
groupId, artifactId or version attributes when configuring the
MavenPublication.
i don't know if i got anything wrong but is there a way to override the version of a maven package. Also publishing something like -SNAPSHOT to my local maven repo would help me a lot.
It works for me with Gradle 7.6.
$./gradlew publishToMavenLocal -Pversion=31
...
BUILD SUCCESSFUL in 1s
21 actionable tasks: 18 executed, 3 up-to-date
$ls -al ~/.m2/repository/com/foo/bar/client
total 8
drwxr-xr-x 4 johnkramer staff 128 Jan 26 18:05 .
drwxr-xr-x 5 johnkramer staff 160 Jan 26 18:05 ..
drwxr-xr-x 6 johnkramer staff 192 Jan 26 18:05 31
-rw-r--r-- 1 johnkramer staff 334 Jan 26 18:05 maven-metadata-local.xml

Building Android OS For Devices

I am trying to build Android OS. I've set up my machine and everything is going on fine, but selecting the device configuration is my concern. When I type lunch, I get:
1 arm-eng
2 aosp_shamu-userdebug
3 aosp_fugu-userdebug
4 aosp_flounder-userdebug
5 aosp_hammerhead-userdebug
6 aosp_flo-userdebug
7 aosp_deb-userdebug
8 full_manta-userdebug
9 full_mako-userdebug
10 full_grouper-userdebug
11 full_tilapia-userdebug
12 full_maguro-userdebug
13 aosp_toro-userdebug
14 (toroplus) aosp_toroplus-userdebug
15 aosp_panda-userdebug
16 full_wingray-userdebug
17 full_crespo-userdebug
18 full_crespo4g-userdebug
I have a device called Injoo 1s, that's what I want to use to test. How do I choose which configuration. Or, I've to write some codes to fix that. Your response would be appreciated. Thank You.
The lunch combos are configured via files called vendorsetup.sh. Your device should have such a file under <android>/device/<your-vendor>/<your-device> with the following contents:
add_lunch_combo <your-device>-eng
add_lunch_combo <your-device>-user

Is there an NFC API for the Smartwatch 3 (SWR50)

Just to be sure and have clarification of that at first, is the NFC of the Smartwatch 3 just an embedded tag or is it a theoretically fully functioning NFC-chip?
Hoping it's not just a tag, we want to build an Android Wear app using NFC and for this the biggest question is:
Is there (gonna be?) a API to use the NFC chip of the SWR50?
If not is there any other way to activate it, or maybe might an updated version of Android Wear bring support for the chip to the smartwatch?
Any help is appreciated!
Thanks, Chris
TLDR:
Basically it's the same question for the new smartwatch 3 of sony: Is NFC usable for developers?
Is there an NFC API for the Sony SmartWatch 2?
I finally got my hands on one of those smart watches. This is what I found so far.
Scanning the SWR50 as a tag:
The SWR50 is identified as an NFC Forum Type 2 Tag manufactured by Broadcom. The 7-byte-UID of the watch that I tested is 2e020d00000000. Both, the fact that I could not find any dedicated Type 2 tags from Broadcom and the many zeros in the UID, make me think that this might be a tag emulated using some NFC controller.
The tag has 122 blocks (times 4 bytes makes 488 bytes in total) containing the following data:
0: 2e 02 0d 0c 1: 00 00 00 00
2: 00 00 ff ff 3: e1 11 3c 0f
4: 00 00 00 01 5: 03 78 30 35
6: 03 31 d4 0f 7: 1f 61 6e 64
8: 72 6f 69 64 9: 2e 63 6f 6d
10: 3a 70 6b 67 11: 63 6f 6d 2e
12: 67 6f 6f 67 13: 6c 65 2e 61
14: 6e 64 72 6f 15: 69 64 2e 77
16: 65 61 72 61 17: 62 6c 65 2e
18: 61 70 70 fe 19: ff ff ff ff
20: 30 a8 db f2 21: 43 1c ff ff
22: 30 a8 db f5 23: 2a 78 ff ff
24: 14 39 2d 4d 25: f2 6a 91 40
26: ff ff ff ff 27: ff ff ff ff
(remaining blocks are all filled with ff ff ff ff)
The static lock bits (block 2, bytes 2 and 3) are all set (indicates locked state).
Block 3 contains a capability container for a Type 2 tag (magic byte 0xE1).
However, the mapping version number 1.1 (0x11) does not comply to any of the current mapping version documents provided by the NFC Forum! The only mapping version number that is currently defined is 1.0.
Block 4 contains 3 NULL TLVs (0x00) and the first byte of a Lock Control TLV (tag 0x01).
The Lock Control TLV indicates that there are 48 lock bits located starting at byte position 232 (= 7 * 25 + 8). I.e. 6 bytes starting at block 58, so they are all set (0xFFFFFFFFFFFF). Each lock bit locks 3 bytes, so they indicate that blocks 16 to 51 are locked.
Block 6 contains the start of an NDEF Message TLV (tag 0x03, length 0x31). The NDEF message consists of a single NDEF record (Android Application Record for app com.google.android.wearable.app):
+--------------------------------------------+
| TNF: EXTERNAL TYPE |
| Type: urn:nfc:ext:android.com:pkg |
+--------------------------------------------+
| Payload: com.google.android.wearable.app |
+--------------------------------------------+
Block 18 contains a Terminator TLV (tag 0xFE) indicating the last TLV block within the tag memory area.
Blocks 20 and 21 (first 2 bytes) contain the device Bluetooth address.
Blocks 22 and 23 (first 2 bytes) contain something that looks like a Bluetooth address too.
Blocks 24 and 25 contain the device serial number.
The remaining blocks are all filled with FF FF FF FF.
Android NFC API access:
Requesting an instance of the NFC adapter fails (the getDefaultAdapter() method returns null):
NfcManager nfcMgr = (NfcManager)mContext.getSystemService(Context.NFC_SERVICE);
NfcAdapter nfcAdapter = nfcMgr.getDefaultAdapter(); // -> null
In addition there is a log message that the device does not support NFC.
V/NFC: this device does not have NFC support
Looking at the NFC system features, none of the NFC system features are available:
PackageManager pkgMgr = mContext.getPackageManager();
boolean featureNfc = pkgMgr.hasSystemFeature("android.hardware.nfc"); // -> false
boolean featureHce = pkgMgr.hasSystemFeature("android.hardware.nfc.hce"); // -> false
Both featureNfc and featureHce are false, so neither android.hardware.nfc nor android.hardware.nfc.hce are available.
So there is currently no NFC API available on the SWR50.
Firmware analysis:
There is a file named BCM43341B0_002.001.014.0122.0174.hcd under /system/vendor/firmware/, so it seems that the watch actually does contain Broadcom's BCM43341 quad-radio chip which also contains an NFC controller.
/proc/misc lists bcm2079x, so it seems that the bcm2079x driver was compiled into the kernel.
There is no NFC service app (Nfc*.apk) on the /system partition.
So there might be support for NFC from the hardware side and the kernel side, but the user-space part of the NFC stack is missing. Though the kernel driver might just as well point to nowhere. And the firmware of the BCM43341 might be coded in a way that the NFC controller simply emulates the Type 2 tag while being inaccessible from the operating system.
There is a fully functional chip in the SmartWatch 3. It is today acting according to the spec linked by CM787 (here's a new one as the old one seems dead).
When Android Wear officially expands on the support for NFC, the SmartWatch 3 will be able to follow.
Nope. It says the NFC is for powering on or pairing on the spec sheet. Doesn't look like 3rd party developers are going to get a crack at it this time around.
The smartwatch supports NFC, based on the specs here http://www.smartwatchspecifications.com/Device/smartwatch-3-swr50/, yet there is no NFC API available as of now, hopefully there will be one, I'm also looking for this functionality, planning to develop apps with this feature

Reading MS Excel 2010 files in android using Apache POI

I am using Apache POI in my android application to read xlsx file stored in SDCARD.
I am using following jar libs from Apache POI
poi-ooxml-schemas-3.9-20121203.jar
poi-ooxml-3.9-20121203.jar
But when I try to Run Android App I am getting below mentioned stacktrace.
trouble writing output: Too many methods: 66024; max is 65536. By package:
13 java.lang
1 java.lang.reflect
5 java.util
1 javax.xml.namespace
66 org.apache.xmlbeans
19 org.apache.xmlbeans.impl.values
1 org.apache.xmlbeans.impl.xb.xmlschema
2500 org.openxmlformats.schemas.drawingml.x2006.chart
1430 org.openxmlformats.schemas.drawingml.x2006.chart.impl
8767 org.openxmlformats.schemas.drawingml.x2006.main
5258 org.openxmlformats.schemas.drawingml.x2006.main.impl
86 org.openxmlformats.schemas.drawingml.x2006.picture
33 org.openxmlformats.schemas.drawingml.x2006.picture.impl
745 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing
417 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.impl
230 org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing
164 org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.impl
298 org.openxmlformats.schemas.officeDocument.x2006.customProperties
256 org.openxmlformats.schemas.officeDocument.x2006.customProperties.impl
617 org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes
596 org.openxmlformats.schemas.officeDocument.x2006.docPropsVTypes.impl
285 org.openxmlformats.schemas.officeDocument.x2006.extendedProperties
196 org.openxmlformats.schemas.officeDocument.x2006.extendedProperties.impl
23 org.openxmlformats.schemas.officeDocument.x2006.math
24 org.openxmlformats.schemas.officeDocument.x2006.relationships
2 org.openxmlformats.schemas.officeDocument.x2006.relationships.impl
2076 org.openxmlformats.schemas.presentationml.x2006.main
1224 org.openxmlformats.schemas.presentationml.x2006.main.impl
1 org.openxmlformats.schemas.schemaLibrary.x2006.main
7271 org.openxmlformats.schemas.spreadsheetml.x2006.main
4556 org.openxmlformats.schemas.spreadsheetml.x2006.main.impl
11448 org.openxmlformats.schemas.wordprocessingml.x2006.main
9217 org.openxmlformats.schemas.wordprocessingml.x2006.main.impl
4 schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707
1170 schemasMicrosoftComOfficeExcel
1223 schemasMicrosoftComOfficeExcel.impl
285 schemasMicrosoftComOfficeOffice
124 schemasMicrosoftComOfficeOffice.impl
2 schemasMicrosoftComOfficePowerpoint
3 schemasMicrosoftComOfficeWord
2858 schemasMicrosoftComVml
2529 schemasMicrosoftComVml.impl
[2013-11-25 21:20:32 - CRD] Conversion to Dalvik format failed with error 2
Can anyone tell where am I missing?
If you use too much code for any android app, the compilation will throw this error. The similar problem is stated and resolved here. You should split the app in parts as a plugin, in the form of a separate APK available for download. That APK would expose some component that the main app would use. There are various app on google play of such kind.
Please note that there are a number of problems when using Apache POI on Android. The one you are hitting can be solved by the so called "multiDex" feature in newer versions of Android.
There are currently two projects which try to solve most of the problems for you:
https://github.com/andruhon/android5xlsx
https://github.com/centic9/poi-on-android/ (mainted by me)
The first one is currently based on POI 3.12, whereas the second can be re-compiled with newer versions of POI more easily.

Memory Leak in Android Phone

I have seen some memory leak in my phone.
Steps :
Open Browser (Home Page : www.google.com). It will fetch the Page.
Select Back Key to come out from browser (close).
Repeat the same steps (1-2) for 5 times.
Observer following data by "adb shell dumpsys meminfo PID (of browser) :
First Time (when open browser first time - After Step 1):
Applications Memory Usage (kB):
Uptime: 428816 Realtime: 434932
** MEMINFO in pid 899 [com.android.browser] **
native dalvik other total
size: 24296 6727 N/A 31023
allocated: 24241 3955 N/A 28196
free: 54 2772 N/A 2826
(Pss): 3455 2259 30025 35739
(shared dirty): 2064 1772 7444 11280
(priv dirty): 3388 548 21116 25052
Objects
Views: 0 ViewRoots: 0
AppContexts: 0 Activities: 0
Assets: 3 AssetManagers: 3
Local Binders: 34 Proxy Binders: 28
Death Recipients: 1
OpenSSL Sockets: 0
Second Time (After Step - 4) Opening - Closing of Browser 5 times :
Applications Memory Usage (kB):
Uptime: 473642 Realtime: 479758
** MEMINFO in pid 899 [com.android.browser] **
native dalvik other total
size: 45616 7559 N/A 53175
allocated: 45322 4850 N/A 50172
free: 29 2709 N/A 2738
(Pss): 4602 2301 51988 58891
(shared dirty): 2060 1736 7440 11236
(priv dirty): 4536 584 42360 47480
Objects
Views: 0 ViewRoots: 0
AppContexts: 0 Activities: 0
Assets: 3 AssetManagers: 3
Local Binders: 113 Proxy Binders: 47
Death Recipients: 1
OpenSSL Sockets: 0
Could you please help us to find out what data here shows which information (like what is Size, Allocated, free, Local Binders etc) and where in above data it is showing that there is memory leak.
New to all these analysis so asking basic questions :-(
Please help me for this.
Thanks
Rke
You know, I don't really see a memory leak here. The most common way to get memory leak is to have references to Activity which had to be destroyed. Anyway, there is a way to search for leak, there is a good article in Android developers blog about memory analysis in Eclipse with MAT and there is also a video from Google IO-2011. Try it, and maybe you'll find what's wrong.

Categories

Resources