分享自己第一次修改6.0源碼并編譯成功的經(jīng)歷——修改恢復出廠設(shè)置原生dialog

前言廢話

一直以來都是從事應用層的開發(fā),也沒有什么機會接觸到怎么修改系統(tǒng)層源碼怎么編譯整個系統(tǒng),直到現(xiàn)在在的公司,是從事手機研發(fā)和智能后視鏡的研發(fā)才有這個機會和親眼目睹一整套從修改底源碼定制root到編譯系統(tǒng)出來再到應用層的開發(fā)是怎么工作起來的,因為自己也蠢蠢欲動開始初次嘗試這些工作,有點小激動...........,廢話不說了開始,過程很痛苦.....

未修改前這個原生是長什么樣子的
需求需要修改的樣子
思路
  • 在應用層先實現(xiàn)這個dialog的效果
  • 找到恢復出廠設(shè)置所在的源碼位置,把我們實現(xiàn)好的dialog替換原生的dialog
在應用層實現(xiàn),這里只粘貼部分代碼
自定義的progress
package com.haisheng.music.circularprogress;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Cap;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.util.Property;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;

import com.haisheng.music.R;

/*
*
*@author luhaisheng  實現(xiàn)跟原生loading效果一樣的progress  CircularProgressView
*@time 2016/10/10 11:40
*/
public class CircularProgressView extends View {

    private static final Interpolator ANGLE_INTERPOLATOR = new LinearInterpolator();
    private static final Interpolator SWEEP_INTERPOLATOR = new AccelerateDecelerateInterpolator();

    private int angleAnimatorDuration;

    private int sweepAnimatorDuration;

    private int minSweepAngle;

    private float mBorderWidth;

    private final RectF fBounds = new RectF();
    private ObjectAnimator mObjectAnimatorSweep;
    private ObjectAnimator mObjectAnimatorAngle;
    private boolean mModeAppearing = true;
    private Paint mPaint;
    private float mCurrentGlobalAngleOffset;
    private float mCurrentGlobalAngle;

    private float mCurrentSweepAngle;
    private boolean mRunning;
    private int[] mColors;
    private int mCurrentColorIndex;
    private int mNextColorIndex;

    public CircularProgressView(Context context) {
        this(context, null);
    }

    public CircularProgressView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public CircularProgressView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

        TypedArray a = context.obtainStyledAttributes(
                attrs,
                R.styleable.CircularProgressView,
                defStyleAttr, 0);

        mBorderWidth = a.getDimension(
                R.styleable.CircularProgressView_borderWidth,
                5);

        angleAnimatorDuration = a.getInt(
                R.styleable.CircularProgressView_angleAnimationDurationMillis,
                2000);

        sweepAnimatorDuration = a.getInt(
                R.styleable.CircularProgressView_sweepAnimationDurationMillis,
                900);

        minSweepAngle = a.getInt(
                R.styleable.CircularProgressView_minSweepAngle,
                30);

        int colorArrayId = a.getResourceId(R.styleable.CircularProgressView_colorSequence,
                R.array.circular_default_color_sequence);
        if (isInEditMode()) {
            mColors = new int[4];
            mColors[0] = getResources().getColor(R.color.circular_blue);
            mColors[1] = getResources().getColor(R.color.circular_blue);
            mColors[2] = getResources().getColor(R.color.circular_blue);
            mColors[3] = getResources().getColor(R.color.circular_blue);
        } else {
            mColors = getResources().getIntArray(colorArrayId);
        }
        a.recycle();

        mCurrentColorIndex = 0;
        mNextColorIndex = 1;

        mPaint = new Paint();
        mPaint.setAntiAlias(true);
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeCap(Cap.ROUND);
        mPaint.setStrokeWidth(mBorderWidth);
        mPaint.setColor(mColors[mCurrentColorIndex]);

        setupAnimations();
    }

    private void innerStart() {
        if (isRunning()) {
            return;
        }
        mRunning = true;
        mObjectAnimatorAngle.start();
        mObjectAnimatorSweep.start();
        invalidate();
    }

    private void innerStop() {
        if (!isRunning()) {
            return;
        }
        mRunning = false;
        mObjectAnimatorAngle.cancel();
        mObjectAnimatorSweep.cancel();
        invalidate();
    }

    private boolean isRunning() {
        return mRunning;
    }

    @Override
    protected void onVisibilityChanged(View changedView, int visibility) {
        super.onVisibilityChanged(changedView, visibility);
        if (visibility == VISIBLE) {
            innerStart();
        } else {
            innerStop();
        }
    }

    @Override
    protected void onAttachedToWindow() {
        innerStart();
        super.onAttachedToWindow();
    }

    @Override
    protected void onDetachedFromWindow() {
        innerStop();
        super.onDetachedFromWindow();
    }

    @Override
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        fBounds.left = mBorderWidth / 2f + .5f;
        fBounds.right = w - mBorderWidth / 2f - .5f;
        fBounds.top = mBorderWidth / 2f + .5f;
        fBounds.bottom = h - mBorderWidth / 2f - .5f;
    }

    @Override
    public void draw(Canvas canvas) {
        super.draw(canvas);
        float startAngle = mCurrentGlobalAngle - mCurrentGlobalAngleOffset;
        float sweepAngle = mCurrentSweepAngle;
        if (mModeAppearing) {
            mPaint.setColor(gradient(mColors[mCurrentColorIndex], mColors[mNextColorIndex],
                    mCurrentSweepAngle / (360 - minSweepAngle * 2)));
            sweepAngle += minSweepAngle;
        } else {
            startAngle = startAngle + sweepAngle;
            sweepAngle = 360 - sweepAngle - minSweepAngle;
        }
        canvas.drawArc(fBounds, startAngle, sweepAngle, false, mPaint);
    }

    private static int gradient(int color1, int color2, float p) {
        int r1 = (color1 & 0xff0000) >> 16;
        int g1 = (color1 & 0xff00) >> 8;
        int b1 = color1 & 0xff;
        int r2 = (color2 & 0xff0000) >> 16;
        int g2 = (color2 & 0xff00) >> 8;
        int b2 = color2 & 0xff;
        int newr = (int) (r2 * p + r1 * (1 - p));
        int newg = (int) (g2 * p + g1 * (1 - p));
        int newb = (int) (b2 * p + b1 * (1 - p));
        return Color.argb(255, newr, newg, newb);
    }

    private void toggleAppearingMode() {
        mModeAppearing = !mModeAppearing;
        if (mModeAppearing) {
            mCurrentColorIndex = ++mCurrentColorIndex % mColors.length;
            mNextColorIndex = ++mNextColorIndex % mColors.length;
            mCurrentGlobalAngleOffset = (mCurrentGlobalAngleOffset + minSweepAngle * 2) % 360;
        }
    }

    private Property<CircularProgressView, Float> mAngleProperty = new Property<CircularProgressView, Float>(Float.class, "angle") {
        @Override
        public Float get(CircularProgressView object) {
            return object.getCurrentGlobalAngle();
        }

        @Override
        public void set(CircularProgressView object, Float value) {
            object.setCurrentGlobalAngle(value);
        }
    };

    private Property<CircularProgressView, Float> mSweepProperty = new Property<CircularProgressView, Float>(Float.class, "arc") {
        @Override
        public Float get(CircularProgressView object) {
            return object.getCurrentSweepAngle();
        }

        @Override
        public void set(CircularProgressView object, Float value) {
            object.setCurrentSweepAngle(value);
        }
    };

    private void setupAnimations() {
        mObjectAnimatorAngle = ObjectAnimator.ofFloat(this, mAngleProperty, 360f);
        mObjectAnimatorAngle.setInterpolator(ANGLE_INTERPOLATOR);
        mObjectAnimatorAngle.setDuration(angleAnimatorDuration);
        mObjectAnimatorAngle.setRepeatMode(ValueAnimator.RESTART);
        mObjectAnimatorAngle.setRepeatCount(ValueAnimator.INFINITE);

        mObjectAnimatorSweep = ObjectAnimator.ofFloat(this, mSweepProperty, 360f - minSweepAngle * 2);
        mObjectAnimatorSweep.setInterpolator(SWEEP_INTERPOLATOR);
        mObjectAnimatorSweep.setDuration(sweepAnimatorDuration);
        mObjectAnimatorSweep.setRepeatMode(ValueAnimator.RESTART);
        mObjectAnimatorSweep.setRepeatCount(ValueAnimator.INFINITE);
        mObjectAnimatorSweep.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {

            }

            @Override
            public void onAnimationEnd(Animator animation) {

            }

            @Override
            public void onAnimationCancel(Animator animation) {

            }

            @Override
            public void onAnimationRepeat(Animator animation) {
                toggleAppearingMode();
            }
        });
    }

    public void setCurrentGlobalAngle(float currentGlobalAngle) {
        mCurrentGlobalAngle = currentGlobalAngle;
        invalidate();
    }

    public float getCurrentGlobalAngle() {
        return mCurrentGlobalAngle;
    }

    public void setCurrentSweepAngle(float currentSweepAngle) {
        mCurrentSweepAngle = currentSweepAngle;
        invalidate();
    }

    public float getCurrentSweepAngle() {
        return mCurrentSweepAngle;
    }
}

自定義的CustomWaitDialog
package com.haisheng.music.circularprogress;

import android.app.Dialog;
import android.content.Context;
import android.widget.TextView;

import com.haisheng.music.R;


public class CustomWaitDialog extends Dialog {
    
    private TextView nTextView;
    private CharSequence nText;

    private CustomWaitDialog(Context context) {
        this(context, 0);
    }

    private CustomWaitDialog(Context context, int theme) {
        super(context, R.style.CustomDialogHolo);

        setContentView(R.layout.custom_wait_dialog_layout);
        nTextView = (TextView) findViewById(R.id.text_off_or_reboot);

        setCancelable(false);
        setCanceledOnTouchOutside(false);
    }

    public void setText(CharSequence text) {
        nText = text;
    }

    @Override
    public void show() {

        nTextView.setText(nText);

        super.show();

    }

    public static class Builder {
        private CustomWaitDialog mDialog;

        public Builder(Context context) {
            mDialog = new CustomWaitDialog(context);
        }

        public Builder setText(CharSequence text) {
            mDialog.setText(text);
            return this;
        }

        public CustomWaitDialog build() {
            return mDialog;
        }

        public void setCanceledOnTouchOutside(boolean flag) {
            mDialog.setCanceledOnTouchOutside(flag);
        }
    }

}

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
              android:layout_width="240dp"
              android:layout_height="112dp"
              android:background="@drawable/laun_po_bg"

    >

    <com.example.lu.myapplication.CircularProgressView
        android:id="@+id/pv"
        android:layout_width="32dp"
        android:layout_height="32dp"
        android:layout_centerVertical="true"
        android:layout_marginLeft="32dp"
        app:borderWidth="3.34dp"
        app:colorSequence="@array/circular_default_color_sequence"
        app:angleAnimationDurationMillis="2000"
        app:sweepAnimationDurationMillis="900"
         />

    <TextView
        android:id="@+id/text_off_or_reboot"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/pv"
        android:layout_marginLeft="20dp"
        android:layout_centerVertical="true"
        android:text="正在恢復出廠設(shè)置"
        android:textColor="#666666"
        android:textSize="16sp"/>

</RelativeLayout>

CustomWaitDialog的簡單使用
new CustomWaitDialog.Builder(this).setText("正在恢復出廠設(shè)置").build().show();
效果
在應用層實現(xiàn)很簡單,也能實現(xiàn)預期的效果,接下來查看源碼恢復出廠設(shè)置的代碼所在的位置,在這里我所修改的是MTK提供的android 6.0源碼,其他的改動位置估計也差不多,但要實踐才知道。
  • 找到位置\alps\frameworks\base\services\core\java\com\android\server\power目錄下的ShutdownThread.java文件

  • 分析這個類的源碼。這里順便說 ,我還不知道有什么比較好的ide查看源碼,所以我是用vim打開的。
    1、查看beginShutdownSequence()代碼

    
         .....
         ......
        // Throw up a system dialog to indicate the device is rebooting / shutting down.
        ProgressDialog pd = new ProgressDialog(context);
    
        // Path 1: Reboot to recovery and install the update
        //   Condition: mRebootReason == REBOOT_RECOVERY and mRebootUpdate == True
        //   (mRebootUpdate is set by checking if /cache/recovery/uncrypt_file exists.)
        //   UI: progress bar
        //
        // Path 2: Reboot to recovery for factory reset
        //   Condition: mRebootReason == REBOOT_RECOVERY
        //   UI: spinning circle only (no progress bar)
        //
        // Path 3: Regular reboot / shutdown
        //   Condition: Otherwise
        //   UI: spinning circle only (no progress bar)
        if (PowerManager.REBOOT_RECOVERY.equals(mRebootReason)) {
            mRebootUpdate = new File(UNCRYPT_PACKAGE_FILE).exists();
            if (mRebootUpdate) {
                pd.setTitle(context.getText(com.android.internal.R.string.reboot_to_update_title));
                pd.setMessage(context.getText(
                        com.android.internal.R.string.reboot_to_update_prepare));
                pd.setMax(100);
                pd.setProgressNumberFormat(null);
                pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
                pd.setProgress(0);
                pd.setIndeterminate(false);
            } else {
                // Factory reset path. Set the dialog message accordingly.
                pd.setTitle(context.getText(com.android.internal.R.string.reboot_to_reset_title));
                pd.setMessage(context.getText(
                        com.android.internal.R.string.reboot_to_reset_message));
                pd.setIndeterminate(true);
            }
        } else {
            pd.setTitle(context.getText(com.android.internal.R.string.power_off));
            pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
            pd.setIndeterminate(true);
        }
        pd.setCancelable(false);
        pd.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
    
        // start the thread that initiates shutdown
        sInstance.mContext = context;
        sInstance.mPowerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
        sInstance.mHandler = new Handler() {
        };
    
        beginAnimationTime = 0;
        boolean mShutOffAnimation = configShutdownAnimation(context);
        int screenTurnOffTime = getScreenTurnOffTime(context);
        synchronized (mEnableAnimatingSync) {
            if (mEnableAnimating) {
                if (mShutOffAnimation) {
                    Log.d(TAG, "mIBootAnim.isCustBootAnim() is true");
                    bootanimCust(context);
                } else {
                    pd.show();
    
                    sInstance.mProgressDialog = pd;
                }
                sInstance.mHandler.postDelayed(mDelayDim, screenTurnOffTime);
            }
        }
    
 分析:ProgressDialog  是系統(tǒng)的dialog,然后稍微往下看到.show()方法才是重點,這里說明了什么時候show出來,show出來之后又把這個dialog賦給了sInstance.mProgressDialog,接下來就要找這個sInstance.mProgressDialog,在什么時候給dismiss掉。

 2、查看running()代碼
```java
......
......
            //To void previous UI flick caused by shutdown animation stopping before BKL turning off
            if (sInstance.mProgressDialog != null) {
                sInstance.mProgressDialog.dismiss();
            } else if (beginAnimationTime > 0) {
                Log.i(TAG, "service.bootanim.exit = 1");
                SystemProperties.set("service.bootanim.exit", "1");
            }
.......
.......

分析:順利找到dismiss的位置。接下來就是修改這兩個位置

開始修改ShutdownThread.java 這個類的源碼
  • 申明全局變量CustomWaitDialog
        // IPO
      private static CustomWaitDialog pd = null;
    
  • 修改 beginShutdownSequence()方法

       ......   
       ......
       //2016-9-24 luhaisheng

        // Throw up a system dialog to indicate the device is rebooting / shutting down.
       // ProgressDialog pd = new ProgressDialog(context);

        // Path 1: Reboot to recovery and install the update
        //   Condition: mRebootReason == REBOOT_RECOVERY and mRebootUpdate == True
        //   (mRebootUpdate is set by checking if /cache/recovery/uncrypt_file exists.)
        //   UI: progress bar
        //
        // Path 2: Reboot to recovery for factory reset
        //   Condition: mRebootReason == REBOOT_RECOVERY
        //   UI: spinning circle only (no progress bar)
        //
        // Path 3: Regular reboot / shutdown
        //   Condition: Otherwise
        //   UI: spinning circle only (no progress bar)
        if (PowerManager.REBOOT_RECOVERY.equals(mRebootReason)) {
            mRebootUpdate = new File(UNCRYPT_PACKAGE_FILE).exists();
            if (mRebootUpdate) {
         //       pd.setTitle(context.getText(com.android.internal.R.string.reboot_to_update_title));
          //      pd.setMessage(context.getText(
                  //      com.android.internal.R.string.reboot_to_update_prepare));
           //     pd.setMax(100);
            //    pd.setProgressNumberFormat(null);
            //    pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            //    pd.setProgress(0);
             //   pd.setIndeterminate(false);
            } else {
                // Factory reset path. Set the dialog message accordingly.
             //   pd.setTitle(context.getText(com.android.internal.R.string.reboot_to_reset_title));
             //   pd.setMessage(context.getText(
              //          com.android.internal.R.string.reboot_to_reset_message));
              //  pd.setIndeterminate(true);
            }
        } else {
          //  pd.setTitle(context.getText(com.android.internal.R.string.power_off));
          //  pd.setMessage(context.getText(com.android.internal.R.string.shutdown_progress));
          //  pd.setIndeterminate(true);
        }
      //  pd.setCancelable(false);
      //  pd.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);

        // start the thread that initiates shutdown
        sInstance.mContext = context;
        sInstance.mPowerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
        sInstance.mHandler = new Handler() {
        };

        beginAnimationTime = 0;
        boolean mShutOffAnimation = configShutdownAnimation(context);
        int screenTurnOffTime = getScreenTurnOffTime(context);
        synchronized (mEnableAnimatingSync) {
            if (mEnableAnimating) {
                if (mShutOffAnimation) {
                    Log.d(TAG, "mIBootAnim.isCustBootAnim() is true");
                    bootanimCust(context);
                } else {
                     pd = new CustomWaitDialog.Builder(context).build();
                    //luhaisheng 2016/10/10
                    if(mReboot){
                        pd.setText(context.getText(com.android.internal.R.string.custom_text_reboot_ing));
                    }else{
                        pd.setText(context.getText(com.android.internal.R.string.custom_text_off_ing));
                        }
                    pd.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
                    /* To fix video+UI+blur flick issue */
                    pd.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
                    pd.show();
            
       //luhaisheng 2016/10/10
                  //  pd.show();

                  //  sInstance.mProgressDialog = pd;
                }
                sInstance.mHandler.postDelayed(mDelayDim, screenTurnOffTime);
            }
        }

在這里主要修改三個地方,第一個是注釋掉原來pd的地方,第二個是在

if(mReboot){ 
pd.setText(context.getText(com.android.internal.R.string.custom_text_reboot_ing)); 
}else{ 
pd.setText(context.getText(com.android.internal.R.string.custom_text_off_ing)); }

通過mReboot判斷是否重啟,第三個是注釋掉原來的show方法。

  • 修改 running()
            //To void previous UI flick caused by shutdown animation stopping before BKL turning off
          //  if (sInstance.mProgressDialog != null) {
           //     sInstance.mProgressDialog.dismiss();
            //2016-09-24 luhaisheng
             if(pd!=null){
                 pd.dismiss();
                 pd=null;
            } else if (beginAnimationTime > 0) {
                Log.i(TAG, "service.bootanim.exit = 1");
                SystemProperties.set("service.bootanim.exit", "1");
            }

在原來的判斷dimiss方法上修改。以上就是修改ShutdownThread.java所做的工作,看起來也不簡單,因為要分析源碼,而且不能像修改應用層那么便捷因為你還沒有引用資源,自定義的類,還要編譯系統(tǒng),刷機才能看到最終的效果,反正繼續(xù)往下做,至于為什么這么修改,有時間的同學自己研究下源碼,看這么修改是否有問題,也可以有其他的修改方式。

引入自定義類 CircularProgressView和CustomWaitDialog

*在alps\frameworks\base\services\core\java\com\android\server\power目錄下放置
CircularProgressView.java與CustomWaitDialog.java,也就是與修改的ShutdownThread.java同級。

*編輯CircularProgressView.java 修改導入的包名和引入的R。修改如下

package com.android.server.power;

import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Cap;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.util.Property;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;

import com.android.internal.R;
.....

分析:就修改了兩個地方,package 是com.android.server.power,和導入的R是com.android.internal.R,不然肯定出錯。
同理CustomWaitDialog.java 也是這么改的。

添加資源文件和修改資源文件(最最最麻煩的地方)
  • 在alps\frameworks\base\core\res\res\drawable-hdpi目錄下放置資源圖片,我這里只需要放置一張
  • 為添加的資源圖片文件添加id(id 是自己手動添加的 沒有ide 自動導入 很麻煩),編輯alps\frameworks\base\core\res\res\values 目錄下public.xml的文件,自增一個type="drawable" 的item。我的是
<public type="drawable" name="laun_po_bg"  id="0x010800b6"/>
  • 為布局文件中的控件TextView申明id text_off_or_reboot。編譯alps\frameworks\base\core\res\res\目錄下ids.xml的文件,編輯如下:
<!--2016 1009 luhaisheng-->
  <item type="id" name="text_off_or_reboot" />

  <item type="id" name="pv" />

所以你自己定義的控件id都需要再ids.xml下做申明,還需要在public.xml下添加id,添加如下:

      <public type="id" name="text_off_or_reboot" id="0x0102003e"/>
      <public type="id" name="pv" id="0x0102003f"/>
  • 與添加控件的id類似,所以自定義的style,layout,string,color等,都需要在相應的目錄下申明,然后在public.xml下添加id。我的public.xml如下所示:

      <public type="style" name="CustomDialogHolo" id="0x010302e0"/>
      <public type="layout" name="custom_wait_dialog_layout" id="0x01090018"/>
      <public type="id" name="text_off_or_reboot" id="0x0102003e"/>
      <public type="id" name="pv" id="0x0102003f"/>

      <public type="string" name="custom_text_off_ing" id="0x01040019"/>
      <public type="string" name="custom_text_reboot_ing" id="0x01040020"/>
      <public type="drawable" name="laun_po_bg"  id="0x010800b6"/>
     
      <public type="attr" name="borderWidth" id="0x010104f2" />
       <public type="attr" name="colorSequence" id="0x010104f3" />
       <public type="attr" name="sweepAnimationDurationMillis" id="0x010104f4" />
       <public type="attr" name="angleAnimationDurationMillis" id="0x010104f5" />
        <public type="attr" name="minSweepAngle" id="0x010104f6" />

      <public type="array" name="circular_default_color_sequence" id="0x01070006" />
      
       <public type="color" name="circular_blue" id="0x0106001c" />
等資源添加確定無誤后,其實誰也不能確定,那么就開執(zhí)行編譯吧,因為出錯看錯就好了,像這種一般都是添加資源時候漏了申明某個id,或者id沖突之類的,我就錯了好幾十次了,保存好所有修改,后在framework/base/core/res/res/ 下mm編譯一次,無誤后在跟目錄下make update-api,update成功之后就可以編譯整個系統(tǒng)了。
  • 在跟目錄下執(zhí)行 source build/envsetup.sh
  • lunch 找到與你硬件相對于的版本
  • make -j8 開始編譯整個系統(tǒng)
這個過程下來從update到編譯這個系統(tǒng)我的計算機花了差不多兩個小時,從中還有不少的錯誤,一直到正確出來刷機花了一天的時間,所以搞這方面的真的很需要耐心。至于系統(tǒng)怎么編譯,這個不是我說所的重點。不懂的請自己google。接下來我傳上,我修改源碼的所以涉及到的文件和資源到github。https://github.com/justinhaisheng/-----Mask_Clear
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 230,362評論 6 544
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 99,577評論 3 429
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 178,486評論 0 383
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經(jīng)常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,852評論 1 317
  • 正文 為了忘掉前任,我火速辦了婚禮,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 72,600評論 6 412
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 55,944評論 1 328
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,944評論 3 447
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 43,108評論 0 290
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 49,652評論 1 336
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 41,385評論 3 358
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 43,616評論 1 374
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 39,111評論 5 364
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 44,798評論 3 350
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 35,205評論 0 28
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 36,537評論 1 295
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 52,334評論 3 400
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 48,570評論 2 379

推薦閱讀更多精彩內(nèi)容