Android 2.1 移動設備 3G 圖標 Source code 的修改 教學

Android 2.1 移動設備 3G 圖標 Source code 的修改 教學

今天將 android 2.1 中狀態欄中手機、3G 等信號圖片去除掉,因為開發 android2.1 是作 MID 終端使用,手機模塊用不著,信號在狀態欄上不和諧了。

目錄:frameworks/base/services/java/com/android/server/status/StatusBarPolicy.java
主要除去兩部分:

(1)在 private StatusBarPolicy(Context context, StatusBarService service) 中去除下面關於手機信號的部分代碼


/* phone_signal
        mPhone = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
        mPhoneData = IconData.makeIcon("phone_signal",
                null, com.android.internal.R.drawable.stat_sys_signal_null, 0, 0);
        mPhoneIcon = service.addIcon(mPhoneData, null);
        // register for phone state notifications.
        ((TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE))
                .listen(mPhoneStateListener,
                          PhoneStateListener.LISTEN_SERVICE_STATE
                         | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS
                         | PhoneStateListener.LISTEN_CALL_STATE
                        | PhoneStateListener.LISTEN_DATA_CONNECTION_STATE
                        | PhoneStateListener.LISTEN_DATA_ACTIVITY);
        // data_connection
        mDataData = IconData.makeIcon("data_connection",
                null, com.android.internal.R.drawable.stat_sys_data_connected_g, 0, 0);
        mDataIcon = service.addIcon(mDataData, null);
        service.setIconVisibility(mDataIcon, false);
*/
/*   mCdmaRoamingIndicatorIconData = IconData.makeIcon("cdma_eri",
                null, com.android.internal.R.drawable.stat_sys_roaming_cdma_0, 0, 0);
        mCdmaRoamingIndicatorIcon = service.addIcon(mCdmaRoamingIndicatorIconData, null);
        service.setIconVisibility(mCdmaRoamingIndicatorIcon, false);  */


(2)去除過濾信號部分
// filter.addAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
還有接受方法onReceive(Context context, Intent intent)中代碼

/*else if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) {
                updateSimState(intent);
            }*/

引用 a樂饗z
較新的 較舊