トラッキング コード

8/25/2011

About Display in HoneyComb

There was the following question at stackoverflow site.

How can I get android Honeycomb system's screen width and height?


I think Display.getHight was include SystemBar.
I have confirmed the following things in NexusS and Xoom.

Display display = getWindowManager().getDefaultDisplay();
DisplayMetrics displayMetrics = new DisplayMetrics();
display.getMetrics(displayMetrics);
        
Log.e("","------------------ ");
Log.e("","display.getHeight() = " + display.getHeight());
Log.e("","display.getWidth() = " + display.getWidth());
Log.e("","------------------ ");
Log.e("","displayMetrics.heightPixels = " + displayMetrics.heightPixels);
Log.e("","displayMetrics.widthPixels = " + displayMetrics.widthPixels);
Log.e("","------------------ ");



Results were as follows:

Nexus S
    display.getHeight() = 800
    display.getWidth() = 480

Xoom
    display.getHeight() = 752
    display.getWidth() = 1280



Xoom will not include status bar height.

getHeight() is include statusbar in GingerBread, not in Honeycomb.

8/20/2011

Using NFC part 1

I try to develop simple NFC application.

Describe the parameters needed to AndroidManifest.xml

Add the necessary permissions to use an NFC Hardware.




When up to AndroidMarket, uses the terminal to be visible only to add the feature NFC-featured.




If you want to handle the NFC tag in Activity, add intent-filter.


  
  




  



  



You should describe only necessary .
is a tag which is using in android.nfc.action.TECH_DISCOVERED.
and add 'nfc_tech_filter.xml' in yout project, that you want to receive NFC tag in your Activity.
For details, see http://developer.android.com/intl/ja/guide/topics/nfc/index.html#dispatch


    
        android.nfc.tech.IsoDep
        android.nfc.tech.NfcA        
        android.nfc.tech.NfcB
        android.nfc.tech.NfcF
        android.nfc.tech.NfcV
        android.nfc.tech.Ndef
        android.nfc.tech.NdefFormatable
        android.nfc.tech.MifareClassic
        android.nfc.tech.MifareUltralight
    


You should describe only necessary .
XXX is class name in '/frameworks/base/core/java/android/nfc/tech'.

8/17/2011

Analysis of the Android frameworks : Screen Lock Settings

OS version

Android OS 2.3.5_r1


Screen Lock Settings

'Screen unlock security' lock screen can be set from Settings.apk.
Password and pattern information that used unlock screen is managed by 'LockPatternUtils'.



LockPatternUtils class overview

Generate an SHA-1(and MD5) hash for the password / pattern.
Write the hash to file.
Check to see if a password matches the saved password / pattern.
Save password quality to DevicePolicyManager.




8/12/2011

Nexus S Android 2.3.5_r1 modified frameworks - with NFC Keyguard Lock

Nexus S Android 2.3.5_r1 modified frameworks

For features NFC Keyguard Lock, I have customized the Android 2.3.5_r1.


modified:
Settings - add 'NFC' on Screen unlock security menu.
NfcService - System dispatch NFC tag.
KeyguardLock - add 'NFC Lock screen'.







8/04/2011

Heap size that can be used in android: largeHeap = "true"

increase heap memory in application

You can increase heap memory in application from API Level11.
Be written as follows in the android developer site.

Return the approximate per-application memory class of the current device when an application is running with a large heap. This is the space available for memory-intensive applications; most applications should not need this amount of memory, and should instead stay with the getMemoryClass() limit. The returned value is in megabytes. This may be the same size as getMemoryClass() on memory constrained devices, or it may be significantly larger on devices with a large amount of available RAM.
The is the size of the application's Dalvik heap if it has specified android:largeHeap="true" in its manifest.



If you want to use large heap, you should write in AndroidManifest.xml.

android:largeHeap="true"


If you want to check heap size on your device, call ActivityManager.getLargeMemoryClass().


ActivityManager am = ((ActivityManager)getSystemService(Activity.ACTIVITY_SERVICE));
int largeMemory = am.getLargeMemoryClass();

8/03/2011

Analysis of the Android frameworks part1 : PackageManager

OS version

Android OS 2.3.5_r1

PackageManager class overview

Class for retrieving various kinds of information related to the application packages that are currently installed on the device.


PackageManagerService class overview

  • Load apks from "system/app/" directory.
  • Load apks from "data/data/" directory (= download apks).
  • Move package to SD/device.
  • Hold information about installed package .
  • Hold information about Features this devices supports that were read from the xml file.



Note

  • ApplicationPackageManager extended PackageManager  is inner class of CotextImpl.
  • ApplicationPackageManager has a interface IPackageManager.
  • PackageManagerService is the implementation class IPackageManager#stub.
  • PackageManagerService holds information about all packages.







information about Features this devices supports

Feature information read from xml file.

void readPermissions() {
        // Read permissions from .../etc/permission directory.
        File libraryDir = new File(Environment.getRootDirectory(), "etc/permissions");

               : 
               : 

        // Iterate over the files in the directory and scan .xml files
        for (File f : libraryDir.listFiles()) {
            // We'll read platform.xml last
            if (f.getPath().endsWith("etc/permissions/platform.xml")) {
                continue;
            }

               : 
               : 

            readPermissionsFromXml(f);
        }

        // Read permissions from .../etc/permissions/platform.xml last so it will take precedence
        final File permFile = new File(Environment.getRootDirectory(),
                "etc/permissions/platform.xml");
        readPermissionsFromXml(permFile);
    }

    private void readPermissionsFromXml(File permFile) {
               : 
               : 
                } else if ("feature".equals(name)) {
                    String fname = parser.getAttributeValue(null, "name");
                    if (fname == null) {
                        Slog.w(TAG, " without name at "
                                + parser.getPositionDescription());
                    } else {
                        //Log.i(TAG, "Got feature " + fname);
                        FeatureInfo fi = new FeatureInfo();
                        fi.name = fname;
                        mAvailableFeatures.put(fname, fi);
                    }
                    XmlUtils.skipCurrentTag(parser);
                    continue;

                } else {
               : 
               : 
    }


You can see the following from the above sources.
  • read xmls in "system/etc/permissions" directory.
  • read "system/etc/permissions/platform.xml".
  • holds information to put to mAvailableFeatures of private member in class. 



PackageManagerService read xmls from system folder, and put to mAvailableFeatures.
How does xml  built into system.img?
Please view the build environment Nexus S Android_2.3.5_r1, so you can find makefile which are written the following.

file : device/samsung/crespo/device_base.mk

# These are the hardware-specific features
PRODUCT_COPY_FILES += \
 frameworks/base/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \
 frameworks/base/data/etc/android.hardware.camera.flash-autofocus.xml:system/etc/permissions/android.hardware.camera.flash-autofocus.xml \
 frameworks/base/data/etc/android.hardware.camera.front.xml:system/etc/permissions/android.hardware.camera.front.xml \
 frameworks/base/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml \
 frameworks/base/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \
 frameworks/base/data/etc/android.hardware.sensor.proximity.xml:system/etc/permissions/android.hardware.sensor.proximity.xml \
 frameworks/base/data/etc/android.hardware.sensor.light.xml:system/etc/permissions/android.hardware.sensor.light.xml \
 frameworks/base/data/etc/android.hardware.sensor.gyroscope.xml:system/etc/permissions/android.hardware.sensor.gyroscope.xml \
 frameworks/base/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
 frameworks/base/data/etc/android.hardware.nfc.xml:system/etc/permissions/android.hardware.nfc.xml \
 frameworks/base/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml \
 frameworks/base/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml \
 packages/wallpapers/LivePicker/android.software.live_wallpaper.xml:system/etc/permissions/android.software.live_wallpaper.xml


it is mean "Copy from 'system/etc/permissions/XXX.xml to 'frameworks/base/data/etc/XXXX.xml".
When you add a device function on its own, may be added here.