第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

如何從更新引擎服務(wù)獲取更新狀態(tài)?

如何從更新引擎服務(wù)獲取更新狀態(tài)?

森林海 2023-11-01 21:50:18
我想通過UpdateEngine 類使用更新引擎服務(wù)。這個(gè)類允許我像這樣綁定更新引擎服務(wù):updateEngine.bind(new UpdateEngineCallback() {            @Override            public void onStatusUpdate(int status, float v) {            }            @Override            public void onPayloadApplicationComplete(int status) {            }        }, new Handler()) ;綁定服務(wù)時(shí)我需要知道服務(wù)的狀態(tài)。UpdateEngine 類沒有 getStatus() 等函數(shù)。這個(gè) onStatusUpdate 回調(diào)是否保證至少被調(diào)用一次,以便我們在第一次綁定到服務(wù)時(shí)可以知道狀態(tài)?
查看完整描述

1 回答

?
慕婉清6462132

TA貢獻(xiàn)1804條經(jīng)驗(yàn) 獲得超2個(gè)贊

我不知道對于特定版本的 Android 是否有保證,但查看此源代碼,似乎它至少調(diào)用 onStatusUpdate 函數(shù)一次,除非到目前為止沒有嘗試更新。

Status BinderUpdateEngineAndroidService::bind(

    const android::sp<IUpdateEngineCallback>& callback, bool* return_value) {

  callbacks_.emplace_back(callback);

  const android::sp<IBinder>& callback_binder =

      IUpdateEngineCallback::asBinder(callback);

  auto binder_wrapper = android::BinderWrapper::Get();

  binder_wrapper->RegisterForDeathNotifications(

      callback_binder,

      base::Bind(

          base::IgnoreResult(&BinderUpdateEngineAndroidService::UnbindCallback),

          base::Unretained(this),

          base::Unretained(callback_binder.get())));

  // Send an status update on connection (except when no update sent so far),

  // since the status update is oneway and we don't need to wait for the

  // response.

  if (last_status_ != -1)

    callback->onStatusUpdate(last_status_, last_progress_);

  *return_value = true;

  return Status::ok();

}

如果有更好的答案出現(xiàn),我會選擇接受。


查看完整回答
反對 回復(fù) 2023-11-01
  • 1 回答
  • 0 關(guān)注
  • 145 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號