Handler解析

我们知道,在android开发中,耗时操作是不能再主线程中执行的,否则会导致ANR。但是我们又不能在子线程中去更新UI,因为管理view绘制的ViewRootImpl会检查线程

void checkThread() {
        if (mThread != Thread.currentThread()) {
            throw new CalledFromWrongThreadException(
                    "Only the original thread that created a view hierarchy can touch its views.");
        }
    }

在这种场景下,我们一般会用到android中的消息机制,即Handler。Handler的作用和使用方法这里就不细说了。这里主要观察Handler的功能是如何实现的。
看一下Handler的构造函数,Handler的构造函数很多,但最终都会回调到这里

public Handler(Callback callback, boolean async) {
        if (FIND_POTENTIAL_LEAKS) {
            final Class<? extends Handler> klass = getClass();
            if ((klass.isAnonymousClass() || klass.isMemberClass() || klass.isLocalClass()) &&
                    (klass.getModifiers() & Modifier.STATIC) == 0) {
                Log.w(TAG, "The following Handler class should be static or leaks might occur: " +
                    klass.getCanonicalName());
            }
        }

        mLooper = Looper.myLooper();
        if (mLooper == null) {
            throw new RuntimeException(
                "Can't create handler inside thread that has not called Looper.prepare()");
        }
        mQueue = mLooper.mQueue;
        mCallback = callback;
        mAsynchronous = async;
    }

或者这里

public Handler(Looper looper, Callback callback, boolean async) {
        mLooper = looper;
        mQueue = looper.mQueue;
        mCallback = callback;
        mAsynchronous = async;
    }

从上面的构造函数可以看到,如果Looper为null的话,会抛出异常。即在使用Handler前必须构造Looper。那为什么我们平时使用的时候没有构造这个Looper呢。这是因为我们的UI线程也就是ActivityThread,在主线程的入口main方法中会通过Looper.prepareMainLooper()方法来创建主线程的Looper。具体的下面会讲,这里我们知道,Handler必须配合Looper使用。而Looper内有一个属性是MessageQueue,所以我们先来看一下MessageQueue

MessageQueue

MessageQueue即android中的消息队列,是通过单链表实现的,因为单链表在数据插入和删除上比较有优势。MessageQueue主要包含三个操作,enqueueMessage(),next()和quit()。分别是插入一个消息,取出并删除一个消息,清空消息池中消息。下面看一下他们的源码

enqueueMessage()

boolean enqueueMessage(Message msg, long when) {
        //msg.target指的是Handler对象,后面会讲到
        if (msg.target == null) {
            throw new IllegalArgumentException("Message must have a target.");
        }
        if (msg.isInUse()) {
            throw new IllegalStateException(msg + " This message is already in use.");
        }

        synchronized (this) {
            if (mQuitting) {
                IllegalStateException e = new IllegalStateException(
                        msg.target + " sending message to a Handler on a dead thread");
                Log.w(TAG, e.getMessage(), e);
                msg.recycle();
                return false;
            }

            msg.markInUse();
            msg.when = when;
            Message p = mMessages;
            boolean needWake;
            if (p == null || when == 0 || when < p.when) {
                // New head, wake up the event queue if blocked.
                msg.next = p;
                mMessages = msg;
                needWake = mBlocked;
            } else {
                // Inserted within the middle of the queue.  Usually we don't have to wake
                // up the event queue unless there is a barrier at the head of the queue
                // and the message is the earliest asynchronous message in the queue.
                needWake = mBlocked && p.target == null && msg.isAsynchronous();
                Message prev;
                for (;;) {
                    prev = p;
                    p = p.next;
                    if (p == null || when < p.when) {
                        break;
                    }
                    if (needWake && p.isAsynchronous()) {
                        needWake = false;
                    }
                }
                msg.next = p; // invariant: p == prev.next
                prev.next = msg;
            }

            // We can assume mPtr != 0 because mQuitting is false.
            if (needWake) {
                nativeWake(mPtr);
            }
        }
        return true;
    }

可以看到,enqueueMessage的确是向单链表中添加message

next()

Message next() {
        // Return here if the message loop has already quit and been disposed.
        // This can happen if the application tries to restart a looper after quit
        // which is not supported.
        final long ptr = mPtr;
        if (ptr == 0) {
            return null;
        }

        int pendingIdleHandlerCount = -1; // -1 only during first iteration
        int nextPollTimeoutMillis = 0;
        //无限循环
        for (;;) {
            if (nextPollTimeoutMillis != 0) {
                Binder.flushPendingCommands();
            }

            nativePollOnce(ptr, nextPollTimeoutMillis);

            synchronized (this) {
                // Try to retrieve the next message.  Return if found.
                final long now = SystemClock.uptimeMillis();
                Message prevMsg = null;
                Message msg = mMessages;
                if (msg != null && msg.target == null) {
                    // Stalled by a barrier.  Find the next asynchronous message in the queue.
                    do {
                        prevMsg = msg;
                        msg = msg.next;
                    } while (msg != null && !msg.isAsynchronous());
                }
                if (msg != null) {
                    if (now < msg.when) {
                        // Next message is not ready.  Set a timeout to wake up when it is ready.
                        nextPollTimeoutMillis = (int) Math.min(msg.when - now, Integer.MAX_VALUE);
                    } else {
                        // Got a message.
                        mBlocked = false;
                        if (prevMsg != null) {
                            prevMsg.next = msg.next;
                        } else {
                            mMessages = msg.next;
                        }
                        msg.next = null;
                        if (DEBUG) Log.v(TAG, "Returning message: " + msg);
                        msg.markInUse();
                        return msg;
                    }
                } else {
                    // No more messages.
                    nextPollTimeoutMillis = -1;
                }

                // Process the quit message now that all pending messages have been handled.
                if (mQuitting) {
                    dispose();
                    return null;
                }

                // If first time idle, then get the number of idlers to run.
                // Idle handles only run if the queue is empty or if the first message
                // in the queue (possibly a barrier) is due to be handled in the future.
                if (pendingIdleHandlerCount < 0
                        && (mMessages == null || now < mMessages.when)) {
                    pendingIdleHandlerCount = mIdleHandlers.size();
                }
                if (pendingIdleHandlerCount <= 0) {
                    // No idle handlers to run.  Loop and wait some more.
                    mBlocked = true;
                    continue;
                }

                if (mPendingIdleHandlers == null) {
                    mPendingIdleHandlers = new IdleHandler[Math.max(pendingIdleHandlerCount, 4)];
                }
                mPendingIdleHandlers = mIdleHandlers.toArray(mPendingIdleHandlers);
            }

            // Run the idle handlers.
            // We only ever reach this code block during the first iteration.
            for (int i = 0; i < pendingIdleHandlerCount; i++) {
                final IdleHandler idler = mPendingIdleHandlers[i];
                mPendingIdleHandlers[i] = null; // release the reference to the handler

                boolean keep = false;
                try {
                    keep = idler.queueIdle();
                } catch (Throwable t) {
                    Log.wtf(TAG, "IdleHandler threw exception", t);
                }

                if (!keep) {
                    synchronized (this) {
                        mIdleHandlers.remove(idler);
                    }
                }
            }

            // Reset the idle handler count to 0 so we do not run them again.
            pendingIdleHandlerCount = 0;

            // While calling an idle handler, a new message could have been delivered
            // so go back and look again for a pending message without waiting.
            nextPollTimeoutMillis = 0;
        }
    }

next()方法内部是一个无限循环。每当消息队列中有Message时,就将这个Message返回并在链表中删除

quit()

void quit(boolean safe) {
        if (!mQuitAllowed) {
            throw new IllegalStateException("Main thread not allowed to quit.");
        }

        synchronized (this) {
            if (mQuitting) {
                return;
            }
            mQuitting = true;

            if (safe) {
                removeAllFutureMessagesLocked();
            } else {
                removeAllMessagesLocked();
            }

            // We can assume mPtr != 0 because mQuitting was previously false.
            nativeWake(mPtr);
        }
    }

参数safe为false时,执行了removeAllMessagesLocked(),该方法的作用是把MessageQueue消息池中所有的消息全部清空,无论是延迟消息(延迟消息是指通过sendMessageDelayed或通过postDelayed等方法发送的需要延迟执行的消息)还是非延迟消息。
当参数safe为true时,执行了removeAllFutureMessagesLocked方法,通过名字就可以看出,该方法只会清空MessageQueue消息池中所有的延迟消息,并将消息池中所有的非延迟消息派发出去让Handler去处理,removeAllFutureMessagesLocked()相比于removeAllMessagesLocked()方法安全之处在于清空消息之前会派发所有的非延迟消息。

Looper

Looper.prepare()

Looper,顾名思义,循环
看一下Looper的构造函数

private Looper(boolean quitAllowed) {
        mQueue = new MessageQueue(quitAllowed);
        mThread = Thread.currentThread();
    }

这是一个私有的构造函数,不能直接调用
真正构造Looper的是Loopre.prepare()方法和prepareMainLooper()方法:

    public static void prepare() {
        prepare(true);
    }

    private static void prepare(boolean quitAllowed) {
        //多次构造Looper抛出异常,一个线程最多只有一个Looper
        if (sThreadLocal.get() != null) {
            throw new RuntimeException("Only one Looper may be created per thread");
        }
        sThreadLocal.set(new Looper(quitAllowed));
    }

    /**
     * Initialize the current thread as a looper, marking it as an
     * application's main looper. The main looper for your application
     * is created by the Android environment, so you should never need
     * to call this function yourself.  See also: {@link #prepare()}
     */
    public static void prepareMainLooper() {
        prepare(false);
        synchronized (Looper.class) {
            //如果在主线程中手动构造Looper则报错,因为主线程已经有Looper了
            if (sMainLooper != null) {
                throw new IllegalStateException("The main Looper has already been prepared.");
            }
            sMainLooper = myLooper();
        }
    }

结合以上方法,我们可以看到。
Looper.prepare()方法和prepareMainLooper()方法都调用了prepare();
而prepare()方法很简单,new了一个Looper并添加到ThreadLocal(功能见下面说明)。
这里的quitAllowed指的是当前Looper循环是否允许退出,这也是子线程Looper和UI线程Looper构造时的区别。即主线程的Looper不允许退出循环,而子线程的Looper可以退出循环

Android给我们提供了两个退出Looper循环的方法:

public void quit() {
    mQueue.quit(false);
}

public void quitSafely() {
        mQueue.quit(true);
    }

一目了然,只是调用了MessageQueue内部的quit方法,上面已经讲过。需要补充的是,无论是调用了quit方法还是quitSafely方法只会,Looper就不再接收新的消息。即在调用了Looper的quit或quitSafely方法之后,消息循环就终结了,这时候再通过Handler调用sendMessage或post等方法发送消息时均返回false,表示消息没有成功放入消息队列MessageQueue中,因为消息队列已经退出了。
重点:如果我们手动创建了Looper处理事务,当事务处理完成之后应该调用quit或者quitSafely方法退出循环,否则这个子线程就会一直处于等待状态,如果退出循环,子线程会立即终止。

所以当我们需要构造Looper时,调用Looper.prepare()即可。调用之后,Looper的构造函数做了两件事:
1.new了一个MessageQueue(即消息队列)并保存在Looper内部。
2.将当前线程保存在Looper内部

说明:这里的sThreadLocal类型是ThreadLocal。
ThreadLocal是一个线程内部的数据储存类,通过它可以在指定的线程储存数据,数据储存后只有在指定的线程可以获取到。

在这里,即把Looper对象储存到该线程中了。需要使用的时候get出来即可。这一点我们可以通过Looper.myLooper()来验证:

public static @Nullable Looper myLooper() {
        return sThreadLocal.get();
    }

Looper构造完成之后,我们得让他循环起来

Looper.loop()

看一下源码:

public static void loop() {
        //构造完成之后,通过myLooper()取得该线程的looper
        final Looper me = myLooper();
        if (me == null) {
            throw new RuntimeException("No Looper; Looper.prepare() wasn't called on this thread.");
        }
         //取出在Looper构造函数中new的消息队列
        final MessageQueue queue = me.mQueue;

        // Make sure the identity of this thread is that of the local process,
        // and keep track of what that identity token actually is.
        Binder.clearCallingIdentity();
        final long ident = Binder.clearCallingIdentity();
        //无限循环
        for (;;) {
            //我们知道,queue.next()这个方法也是无限循环的
            //只有我们调用了quit方法之后queue.next()才会返回空
            //也就是说,除非我们调用Looper.quit()方法,否则loop方法会一直循环下去
            Message msg = queue.next(); // might block
            if (msg == null) {
                // No message indicates that the message queue is quitting.
                return;
            }

            // This must be in a local variable, in case a UI event sets the logger
            final Printer logging = me.mLogging;
            if (logging != null) {
                logging.println(">>>>> Dispatching to " + msg.target + " " +
                        msg.callback + ": " + msg.what);
            }

            final long traceTag = me.mTraceTag;
            if (traceTag != 0 && Trace.isTagEnabled(traceTag)) {
                Trace.traceBegin(traceTag, msg.target.getTraceName(msg));
            }
            try {
                //获取到消息后,调用handler的dispatchMessage方法将消息分发
                msg.target.dispatchMessage(msg);
            } finally {
                if (traceTag != 0) {
                    Trace.traceEnd(traceTag);
                }
            }

            if (logging != null) {
                logging.println("<<<<< Finished to " + msg.target + " " + msg.callback);
            }

            // Make sure that during the course of dispatching the
            // identity of the thread wasn't corrupted.
            final long newIdent = Binder.clearCallingIdentity();
            if (ident != newIdent) {
                Log.wtf(TAG, "Thread identity changed from 0x"
                        + Long.toHexString(ident) + " to 0x"
                        + Long.toHexString(newIdent) + " while dispatching to "
                        + msg.target.getClass().getName() + " "
                        + msg.callback + " what=" + msg.what);
            }

            msg.recycleUnchecked();
        }
    }

通过源码可以看到,loop()方法和queue.next()一样,也是一个无限循环的方法。并且loop()方法内部调用了queue.next()方法。而next()是一个阻塞操作,当消息队列中没有Message时,queue.next()阻塞,导致loop()方法也一直阻塞在这里,当消息队列中有Message时,立马会被loop()方法获取到。然后调用Handler的dispatchMessage()方法。而dispatchMessage()方法内部又会根据我们传入的参数来调用对应的handleMessage()方法。这样就从消息添加到消息队列,取出消息,又回到我们熟悉的handleMessage啦。接下来我们就讲讲Handler

Handler

在了解了MessageQueue和Looper之后,我们回到Handler的构造方法:

public Handler(Callback callback, boolean async) {
        if (FIND_POTENTIAL_LEAKS) {
            final Class<? extends Handler> klass = getClass();
            if ((klass.isAnonymousClass() || klass.isMemberClass() || klass.isLocalClass()) &&
                    (klass.getModifiers() & Modifier.STATIC) == 0) {
                Log.w(TAG, "The following Handler class should be static or leaks might occur: " +
                    klass.getCanonicalName());
            }
        }

        mLooper = Looper.myLooper();
        if (mLooper == null) {
            throw new RuntimeException(
                "Can't create handler inside thread that has not called Looper.prepare()");
        }
        mQueue = mLooper.mQueue;
        mCallback = callback;
        mAsynchronous = async;
    }

对于上面的mLooper和mQueue我们已经知道是咋回事了。
至于mCallback,他的类型是Callback,Callback是Handler内部的一个interface

public interface Callback {
        public boolean handleMessage(Message msg);
    }

里面只有一个方法,下面还会讲到,先不细说
这里先看一下Handler是如何发送一个消息的,又是如何把消息添加到MessageQueue里的

Handler发送消息的方法很多,
但不论是什么发送方法,最后都会回调到sendMessageAtTime()方法:

public boolean sendMessageAtTime(Message msg, long uptimeMillis) {
        MessageQueue queue = mQueue;
        if (queue == null) {
            RuntimeException e = new RuntimeException(
                    this + " sendMessageAtTime() called with no mQueue");
            Log.w("Looper", e.getMessage(), e);
            return false;
        }
        return enqueueMessage(queue, msg, uptimeMillis);
    }

内部只是判断了一下消息队列的合法性,接着调用了enqueueMessage()方法:

private boolean enqueueMessage(MessageQueue queue, Message msg, long uptimeMillis) {
        //注意:上面多次提到的msg.target即为Handler对象,在这里得到证实
        msg.target = this;
        if (mAsynchronous) {
            msg.setAsynchronous(true);
        }
        return queue.enqueueMessage(msg, uptimeMillis);
    }

在这里可以清楚的看到,源码中先将该Handler对象赋值给Message的target属性。
接着调用了queue.enqueueMessage(msg, uptimeMillis);也就是将消息插入了消息队列当中。
但是需要注意的是,这里的queue(消息队列)是我们在构造Handler时,在Handler的构造方法中新建了Looper,然后在该Looper的构造方法中new新建了这个MessageQueue。所以,这个queue是存在于接收消息线程中的。

结合上面我们现在知道,当发送一个消息的时候,首先会将Handler对象赋值给Message的target属性,并将Message加入到这个线程对应Looper中的MessageQueue里。然后在Looper的Loop.loop()方法中,通过MessageQueue的next()方法取得这个消息(Message)。然后调用msg.target.dispatchMessage(msg);也就是执行了Handler的dispatchMessage()方法。这样一来,消息就从发送消息的线程发送到了接收消息的线程。

我们再看看dispatchMessage()这个方法中具体做了什么:

/**
     * Handle system messages here.
     */
    public void dispatchMessage(Message msg) {
        //利用Handler的post()方法发送消息
        if (msg.callback != null) {
            handleCallback(msg);
        } else {
            //Handler构造函数中的Callback
            if (mCallback != null) {
                if (mCallback.handleMessage(msg)) {
                    return;
                }
            }
            //我们经常复写Handler的handleMessage()方法
            handleMessage(msg);
        }
    }

msg.callback是啥呢?要说清楚这个,我们还是得先看看Handler的post()方法:

public final boolean post(Runnable r)
    {
       return  sendMessageDelayed(getPostMessage(r), 0);
    }

这里又把Runnable传给了getPostMessage(r)方法,不着急,继续看:

private static Message getPostMessage(Runnable r) {
        Message m = Message.obtain();
        m.callback = r;
        return m;
    }

看到这里就很明白了,其实post方法在内部new了一个Message,然后把Runable赋值给了Message的callback属性。

所以,回到dispatchMessage方法中,如果我们利用Handler的post()方法发送消息,则msg.callback!=null,直接回调handleCallback(msg)方法:

private static void handleCallback(Message message) {
        message.callback.run();
    }

也就是执行了Runable中的run()方法。没毛病,和我们想的一样

那么mCallback又是啥呢?还记得Handler构造函数中的mCallback不?对的,就是这个。
也就是说,如果我们构造Handler时,传入Callback对象,则会执行这个Callback中的handleMessage()方法,写法如下:

private Handler mHandler = new Handler(new Handler.Callback() {
        @Override
        public boolean handleMessage(Message msg) {
             
            }
            //返回true,则不再回调Handler中的handleMessage方法。
            return false;
        }
    });

返回值如果返回true,则不再回调Handler中的handleMessage方法。
如果为false,则会回调Handler中的handleMessage方法。

而我们平时常用的写法:

private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            
        }
    };

相当于继承Handler,复写了Handler的handleMessage()方法。也就是说这是一个匿名内部类。

但是这样存在一个问题。
由于Activity和Handler的生命周期不一致,如果子线程耗时操作还没结束时,我们把Activity关闭(finish)。因为这个时候耗时操作还没结束,而匿名内部类又持有外部类(Activity)的引用,所以这个时候Handler持有了Activity的引用。这就导致虽然Activity已经finish()。但是内存却不能被回收,导致内存泄漏。
所以一定要使用这种方式的话最好使用弱引用,否则应该避免这种使用方式。

总结

最后我们总结一下Handler机制的流程:
1.构造Looper,在主线程中不必手动构造,已经存在Looper。
在子线程中需要使用Looper.perpar()构造Looper,用Looper.myLooper()取得Looper,用Looper.loop()开始循环,用Looper.quit()终止循环。
2.在Looper的构造方法内部,会new一个MessageQueue,并储存在Looper内部
3.Looper构造完成之后添加到ThreadLocal中
4.构造Handler,在构造方法中记录该线程的Looper,Looper中的MessageQueue以及Callback
5.发送消息前,要构造Message消息,如果用户没有传入Message消息,则通过Message.obtain()从消息池中获取一个Message。否则使用用户传进来的Message。如果是使用Handler的post()方法发送消息,则把Runable赋值给Message的callback属性。其他情况下,Message的callback属性为null。最后一步,把Handler赋值给Message的target属性。
6.Message构造完成之后,调用第4步中记录的MessageQueue将Message添加到消息队列。
7.添加到消息队列的Message会被Looper.loop()取出
8.从消息队列获取到Message后,调用msg.target.dispatchMessage(msg),也就是调用Handler的dispatchMessage()方法
9.dispatchMessage()方法根据用户传入的参数,回调相应的handleMessage()方法。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,457评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,837评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,696评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,183评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,057评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,105评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,520评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,211评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,482评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,574评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,353评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,213评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,576评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,897评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,174评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,489评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,683评论 2 335

推荐阅读更多精彩内容