炬力方案系統修改雜記

1,android4.4修改WiFi裏顯示的WiFi名

android\frameworks\base\wifi\java\android\net\wifi\p2p下的
WifiP2pService.java下的
private String getPersistedDeviceName() {
        String deviceName = Settings.Global.getString(mContext.getContentResolver(),
                Settings.Global.WIFI_P2P_DEVICE_NAME);
        if (deviceName == null) {
            /* We use the 4 digits of the ANDROID_ID to have a friendly
             * default that has low likelihood of collision with a peer */
            String id = Settings.Secure.getString(mContext.getContentResolver(),
                    Settings.Secure.ANDROID_ID);
            return "Android_" + id.substring(0,4);     //把這個return的值改成你想要的WiFi名稱
        }
        return deviceName;
  }

2,默認位置服務選中“省電模式–Wifi定位”

 public void onRadioButtonClicked(RadioButtonPreference emiter) {
        int mode = Settings.Secure.LOCATION_MODE_OFF;
        if (emiter == mHighAccuracy) {    //默認加載的RadioButtonPreference是mHighAccuracy
//            mode = Settings.Secure.LOCATION_MODE_HIGH_ACCURACY;
              mode = Settings.Secure.LOCATION_MODE_BATTERY_SAVING;
        } else if (emiter == mBatterySaving) {
            mode = Settings.Secure.LOCATION_MODE_BATTERY_SAVING;
        } else if (emiter == mSensorsOnly) {
            mode = Settings.Secure.LOCATION_MODE_SENSORS_ONLY;
        }
        setLocationMode(mode);     //設置模式
    } 

3,從文件管理器打開bmp格式的圖片時,無法顯示圖片

第一步: \MLI-TCH\new_disk\GS702C_4.4\GS702C_sdk\android\packages\apps\Gallery2\src\com\android\gallery3d\app\PhotoPage.java

supportedOperations ^= MediaObject.SUPPORT_EDIT;

修改成

// supportedOperations ^= MediaObject.SUPPORT_EDIT; 
supportedOperations &= ~MediaObject.SUPPORT_EDIT;

第二步:\MLI-TCH\new_disk\GS702C_4.4\GS702C_sdk\android\packages\apps\Gallery2\src\com\android\gallery3d\data\LocalImage.java

    @Override
    public int getSupportedOperations() {
        int operation = SUPPORT_DELETE | SUPPORT_SHARE | SUPPORT_CROP
                | SUPPORT_SETAS | SUPPORT_PRINT | SUPPORT_INFO;
        if (BitmapUtils.isSupportedByRegionDecoder(mimeType)) {
            operation |= SUPPORT_FULL_IMAGE | SUPPORT_EDIT;
        }

修改成

 @Override
    public int getSupportedOperations() {
        int operation = SUPPORT_DELETE | SUPPORT_SHARE
                | SUPPORT_SETAS | SUPPORT_PRINT | SUPPORT_INFO;
        if (BitmapUtils.isSupportedByRegionDecoder(mimeType)) {
            operation |= SUPPORT_FULL_IMAGE;
        }

        if (BitmapUtils.isSupportedByScaleDecoder(mimeType)) {
            operation |= SUPPORT_CROP;
            operation |= SUPPORT_EDIT;
        }

第三步:\MLI-TCH\new_disk\GS702C_4.4\GS702C_sdk\android\packages\apps\Gallery2\src\com\android\gallery3d\data\UriImage.java

@Override
    public int getSupportedOperations() {
        int supported = SUPPORT_PRINT | SUPPORT_SETAS;
        if (isSharable()) supported |= SUPPORT_SHARE;
        if (BitmapUtils.isSupportedByRegionDecoder(mContentType)) {
            supported |= SUPPORT_EDIT | SUPPORT_FULL_IMAGE;
        }
        return supported;
    }

修改成

   @Override
    public int getSupportedOperations() {
        int supported = SUPPORT_PRINT | SUPPORT_SETAS;
        if (isSharable()) supported |= SUPPORT_SHARE;
        if (BitmapUtils.isSupportedByRegionDecoder(mContentType)) {
            supported |= SUPPORT_FULL_IMAGE;
        }

        if (BitmapUtils.isSupportedByScaleDecoder(mContentType)) {
         supported |= SUPPORT_EDIT;
        }

        return supported;
    }

第四步:

    public static boolean isSupportedByRegionDecoder(String mimeType) {
        if (mimeType == null) return false;
        mimeType = mimeType.toLowerCase();
        return mimeType.startsWith("image/") && !mimeType.equals("image/gif");
        //        (!mimeType.equals("image/gif") && !mimeType.endsWith("bmp"));
    }

修改成

     public static boolean isSupportedByRegionDecoder(String mimeType) {
        if (mimeType == null) return false;
        mimeType = mimeType.toLowerCase();
        return mimeType.startsWith("image/") && 
                (!mimeType.equals("image/gif") && !mimeType.endsWith("bmp"));
    }

    public static boolean isSupportedByScaleDecoder(String mimeType) {
        if (mimeType == null) return false;
        mimeType = mimeType.toLowerCase();
        return mimeType.startsWith("image/") &&
                (!mimeType.equals("image/gif"));
    }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章