anroid 各個功能的帖子 和代碼片段

1 anroid 添加快關機動畫

http://www.cnblogs.com/wanqieddy/archive/2012/09/17/2688366.html

4.4.3 一些代碼已經修改,所以如果使用的話,需要測試。

2 ramdisk.img 內容查看的方法

解壓、修改Android的ramdisk.img的手動方法:
    將ramdisk.img複製一份到任何其他目錄下,將其名稱改爲ramdisk.img.gz,並使用命令
    gunzip ramdisk.img.gz
   然後新建一個文件夾,叫ramdisk吧,進入,輸入命令
    cpio -i -F ../ramdisk.img
    這下,你就能看見並操作ramdisk裏面的內容了。
    根據自己的需要對裏面的內容修改之後,可以使用下列命令重新打包成鏡像
    cpio -i -t -F ../ramdisk.img > list
    cpio -o -H newc -O lk.img < list 

    當前目錄下生成的lk.img就是我們的新鏡像了。


3 單擊statusBar中的亮度,以4.4.3原生代碼爲例子。切換幾種亮度。

                PowerManager pm = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
                try {
                    int nowBrightnessValue = android.provider.Settings.System.getInt(mContext.getContentResolver(),
                            Settings.System.SCREEN_BRIGHTNESS);
                    int newBrightness = 0;
                    if (nowBrightnessValue < pm.getMinimumScreenBrightnessSetting()) {
                        newBrightness = pm.getMinimumScreenBrightnessSetting();
                    } else if (nowBrightnessValue < pm.getDefaultScreenBrightnessSetting()) {
                        newBrightness = pm.getDefaultScreenBrightnessSetting();
                    } else if (nowBrightnessValue < pm.getMaximumScreenBrightnessSetting()) {
                        newBrightness = pm.getMaximumScreenBrightnessSetting();
                    }
                    android.provider.Settings.System.putInt(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, newBrightness);
                } catch (Exception e) {
                }

4 手勢下滑http://www.cnblogs.com/yejiurui/p/3803658.html

5 其他應用種調用statusbar,顯示狀態欄的通知。

          Object service = getSystemService("statusbar");
            try {
                Class<?> statusbarManager = Class.forName("android.app.StatusBarManager");
                Method expand = null;
                expand = statusbarManager.getMethod("expandNotificationsPanel");
                expand.setAccessible(true);
                expand.invoke(service);
            } catch (Exception e) {
                e.printStackTrace();
            } catch (Error e) {
                e.printStackTrace();
            }
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />

6 CTS 測試,怎樣繼續中斷的測試,和完成後no run 或fail的。

http://blog.csdn.net/subsist/article/details/7209341

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章