1、去掉锁屏功能:

1)、在frameworks/base/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java修改:

-------------------------------------------
/**
* External apps (like the phone app) can tell us to disable the keygaurd.
*/
private boolean mExternallyEnabled = true;
-------------------------------------------
private boolean mExternallyEnabled = false;
-------------------------------------------
如果采用这种方法,那么在应用程序中仍然可以通过setKeyguardEnabled方法来启动锁屏,
2)、设置默认锁屏时间:
-----------------------------------
frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
private void loadSystemSettings(SQLiteDatabase db) {
loadIntegerSetting(stmt, Settings.System.SCREEN_OFF_TIMEOUT,
R.integer.def_screen_off_timeout);
frameworks/base/packages/SettingsProvider/res/values/defaults.xml
<integer name="def_screen_off_timeout">60000</integer>
-----------------------------------
可以修改<integer name="def_screen_off_timeout">60000</integer>的数值为-1,它是以毫秒为单位,重新编译Setting Provider模块。

但是虽然改成-1,启动后依旧会进入锁屏状态,解锁之后就再也不会锁屏了。
因此在这里这种方法不可取。
3)、如果1和2两种方法结合,就不会启动锁屏了。


2、如何去掉状态栏的电池图标:

1)、在/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/BatteryController.java中加入
import android.view.View;
修改
----------------
public BatteryController(Context context) {
mContext = context;
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_BATTERY_CHANGED);
context.registerReceiver(this, filter);
}
---------------
public BatteryController(Context context) {
mContext = context;
IntentFilter filter = new IntentFilter();
// filter.addAction(Intent.ACTION_BATTERY_CHANGED);
context.registerReceiver(this, filter);
}
----------------
修改
----------------
public void addIconView(ImageView v) {
mIconViews.add(v);
}
-----------------
public void addIconView(ImageView v) {
v.setVisibility(View.GONE);
mIconViews.add(v);
}
-----------------
修改
-----------------
public void addLabelView(TextView v) {
mLabelViews.add(v);
}
-----------------
public void addLabelView(TextView v) {
v.setVisibility(View.GONE);
mLabelViews.add(v);
}
-----------------


3、去掉状态栏的方法

把/system/app/下的SystemUI.apk删掉就可以了。


4、解决不同环境下编译的APK不兼容的问题

修改 dalvik/vm/analysis/DexPrepare.cpp
<pre>
1326 if (memcmp(signature, ptr, kSHA1DigestLen) != 0) {
1327 LOGI("DexOpt:mismatch dep signature for '%s'", cacheFileName);
1328 // goto bail;
1329 }
</pre>
可以解决不同环境下编译的APK不兼容的问题;
当重新编译Android时,必须重新编译APK,如果还是用原来环境下编译的就会出现mismatch dep signature的问题;


5、当重新编译Android时,必须重新编译APK,如果还是用原来环境下编译的就会出现mismatch dep signature的问题;

修改 dalvik/vm/analysis/DexPrepare.cpp

if (memcmp(signature, ptr, kSHA1DigestLen) != 0) {LOGI("DexOpt:mismatch dep signature for '%s'", cacheFileName); //            goto bail;}

可以解决不同环境下编译的APK不兼容的问题;

5、TabHost中去掉标题栏的分割线

在TabWidget中增加属性:android:divider="@null" 即可

6、用代码的方式打开“允许安装来自未知来源的应用”

以下的代码需要平台的签名或者作为系统应用来运行才行
添加签名

    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>    <uses-permission android:name="android.permission.WRITE_SETTINGS"/>    <uses-permission android:name="android.permission.READ_SECURE_SETTINGS"/>    <uses-permission android:name="android.permission.READ_SETTINGS"/>

代码:
    private void setSetting(){        ContentValues values = new ContentValues();        values.put("value", 1);        Cursor cursor = null;        try{            int value = 0;            cursor = getContentResolver().query(Settings.Secure.CONTENT_URI,            new String[] { "value",},            "name=?",            new String[] {Settings.Secure.INSTALL_NON_MARKET_APPS}, null);            if(cursor != null && cursor.moveToNext()){                value = cursor.getInt(cursor.getColumnIndex("value"));            }            if(cursor != null){                cursor.close();                cursor = null;            }            if(0 == value){                int i = getContentResolver().update(Settings.Secure.CONTENT_URI, values,"name=?",                        new String[] {Settings.Secure.INSTALL_NON_MARKET_APPS} );                if(i > 0){                        Log.e("", "success");                }else{                    Log.e("", "fail");                }            }        }catch (Exception e) {            e.printStackTrace();        }finally{            if(cursor != null){                cursor.close();                cursor = null;            }        }    }


7、关于mm编译出来的.apk和.odex安装有关问题

我们在Android sourcecode里面编译package app时发现编译生成两个文件 apk和odex,这样再放入到system/app下可能会发生DexOpt:mismatch dep signature 的问题。
除了4种介绍的方法,另一个解决办法:
在Android.mk中加上:
LOCAL_DEX_PREOPT := false
就不会产生odex文件了,4.0默认的是true,要想改全局的要到build目录下改。



更多相关文章

  1. android 实现流媒体播放远程mp3文件代码
  2. Android实现模拟点击的一种方法
  3. Android scrollview嵌套listview 滑动事件冲突的解决方法
  4. Android Studio sync 失败解决方法
  5. Android 代码中实现返回键功能
  6. Android全屏的两种方法

随机推荐

  1. android 深入需要学习的
  2. 详细的北京安卓培训班课程内容介绍
  3. Android(安卓)am 指令的使用
  4. 用phoneGap打包一个基于Android的WebApp
  5. 使用GDB调试Android(安卓)NDK native(C/C
  6. Android搭建HTTP和WebSocket的服务器端
  7. Android的消息机制————读书笔记
  8. 利用BLCR加快android的启动过程
  9. Intel发布Android模拟器的x86系统映像
  10. Android开发利器之pidcat安装方式