当前位置: 首页 > news >正文

用其他商标在自己网站做宣传简述如何优化网站的方法

用其他商标在自己网站做宣传,简述如何优化网站的方法,军事新闻大事,国内响应式布局网站IMS分为Java层与Native层两个部分,其启动过程是从Java部分的初始化开始,进而完成Native部分的初始化。 □创建新的IMS对象。 □调用IMS对象的start()函数完成启动 同其他系统服务一样,IMS在SystemServer中的ServerT…

IMS分为Java层与Native层两个部分,其启动过程是从Java部分的初始化开始,进而完成Native部分的初始化。

□创建新的IMS对象。

□调用IMS对象的start()函数完成启动

同其他系统服务一样,IMS在SystemServer中的ServerThread线程中启动。

    private void startOtherServices(@NonNull TimingsTraceAndSlog t) {t.traceBegin("startOtherServices");
            inputManager = new InputManagerService(context);inputManager.setWindowManagerCallbacks(wm.getInputManagerCallback());inputManager.start();

创建新的IMS对象

线程 mLooper = DisplayThread.get().getLooper()

构造NativeInputManagerService

    /** Point of injection for test dependencies. */@VisibleForTestingstatic class Injector {private final Context mContext;private final Looper mLooper;Injector(Context context, Looper looper) {mContext = context;mLooper = looper;}Context getContext() {return mContext;}Looper getLooper() {return mLooper;}NativeInputManagerService getNativeService(InputManagerService service) {return new NativeInputManagerService.NativeImpl(service, mLooper.getQueue());}void registerLocalService(InputManagerInternal localService) {LocalServices.addService(InputManagerInternal.class, localService);}}public InputManagerService(Context context) {this(new Injector(context, DisplayThread.get().getLooper()));}
    class NativeImpl implements NativeInputManagerService {/** Pointer to native input manager service object, used by native code. */@SuppressWarnings({"unused", "FieldCanBeLocal"})private final long mPtr;NativeImpl(InputManagerService service, MessageQueue messageQueue) {mPtr = init(service, messageQueue);}

nativeInit()函数创建了一个类型为NativeInputManager的对象,它是Java层与Native层互相通信的桥梁。

com_android_server_input_InputManagerService.cpp
static jlong nativeInit(JNIEnv* env, jclass /* clazz */, jobject serviceObj,jobject messageQueueObj) {sp<MessageQueue> messageQueue = android_os_MessageQueue_getMessageQueue(env, messageQueueObj);if (messageQueue == nullptr) {jniThrowRuntimeException(env, "MessageQueue is not initialized.");return 0;}static std::once_flag nativeInitialize;NativeInputManager* im = nullptr;std::call_once(nativeInitialize, [&]() {// Create the NativeInputManager, which should not be destroyed or deallocated for the// lifetime of the process.im = new NativeInputManager(serviceObj, messageQueue->getLooper());});LOG_ALWAYS_FATAL_IF(im == nullptr, "NativeInputManager was already initialized.");return reinterpret_cast<jlong>(im);
}

看下这个类的声明可以发现,它实现了InputReaderPolicyInterface与InputDispatcher-PolicyInterface两个接口。这说明上一节曾经介绍过的两个重要的输入系统参与者InputReaderPolicy和InputDispatcherPolicy是由NativeInputManager实现的,然而它仅仅为两个策略提供接口实现而已,并不是策略的实际实现者。NativeInputManager通过JNI回调Java层的IMS,由它完成决策。本节暂不讨论其实现细节,读者只要先记住两个策略参与者的接口实现位于NativeInputManager即可。

4  class NativeInputManager : public virtual InputReaderPolicyInterface,
265                             public virtual InputDispatcherPolicyInterface,
266                             public virtual PointerControllerPolicyInterface {

NativeInputManager构造如下:

1、创建一个全局引用,并通过mServiceObj指向上层的InputManagerService对象

2、创建并注册服务InputManager。

原来,InputManager才是底层输入系统的服务,而NativeInputManagerService通过mServiceObj保存了上层InputManagerService引用,并且上层InputManagerService通过mPtr指向底层的NativeInputManager。因此,我们可以判定NativeInputManagerService就是一个连接上层与底层的桥梁。


NativeInputManager::NativeInputManager(jobject serviceObj, const sp<Looper>& looper): mLooper(looper), mInteractive(true) {JNIEnv* env = jniEnv();mServiceObj = env->NewGlobalRef(serviceObj);InputManager* im = new InputManager(this, *this);mInputManager = im;defaultServiceManager()->addService(String16("inputflinger"), im);
}
InputManager.cpp
InputManager::InputManager(const sp<InputReaderPolicyInterface>& readerPolicy,InputDispatcherPolicyInterface& dispatcherPolicy) {mDispatcher = createInputDispatcher(dispatcherPolicy);  4、创建InputDispatcher对象,使用InputReaderPolicyInterfacemProcessor = std::make_unique<InputProcessor>(*mDispatcher);mBlocker = std::make_unique<UnwantedInteractionBlocker>(*mProcessor);mReader = createInputReader(readerPolicy, *mBlocker);  4、创建InputReader对象,使用InputReaderPolicyInterface和InputListenerInterface
}

可以看到InputManager主要做以下几件事:

  • 构造InputDispatcher对象;(用于后续事件分发处理)
  • 构造InputReader对象;(用于事件输入监听)
  • 调用InputDispatcher和InputReader的start()方法;

InputManager构造函数所使用的两个接口,分别由InputDispatcher和InputReader所使用。因此InputManager向上通信的能力是由子模块InputDispatcher和InputReader实现的。

InputManager创建了,InputReader、InputDispatcher。

InputReader负责从EventHub中获取事件,然后把事件加工后,发送给InputClassifier。

最后InputDispatcher会对事件进行分发。

frameworks/native/services/inputflinger/dispatcher/InputDispatcherFactory.cppstd::unique_ptr<InputDispatcherInterface> createInputDispatcher(InputDispatcherPolicyInterface& policy) {return std::make_unique<android::inputdispatcher::InputDispatcher>(policy);
}
std::unique_ptr<InputReaderInterface> createInputReader(const sp<InputReaderPolicyInterface>& policy, InputListenerInterface& listener) {return std::make_unique<InputReader>(std::make_unique<EventHub>(), policy, listener);
}

调用IMS对象的start()函数完成启动

public void start() {Slog.i(TAG, "Starting input manager");mNative.start();
}

static void nativeStart(JNIEnv* env, jobject nativeImplObj) {NativeInputManager* im = getNativeInputManager(env, nativeImplObj);status_t result = im->getInputManager()->start();if (result) {jniThrowRuntimeException(env, "Input manager could not be started.");}
}
status_t InputManager::start() {status_t result = mDispatcher->start();if (result) {ALOGE("Could not start InputDispatcher thread due to error %d.", result);return result;}result = mReader->start();if (result) {ALOGE("Could not start InputReader due to error %d.", result);mDispatcher->stop();return result;}return OK;
}

启动mDispatcher和mReader


status_t InputReader::start() {if (mThread) {return ALREADY_EXISTS;}mThread = std::make_unique<InputThread>("InputReader", [this]() { loopOnce(); }, [this]() { mEventHub->wake(); });return OK;
}

status_t InputDispatcher::start() {if (mThread) {return ALREADY_EXISTS;}mThread = std::make_unique<InputThread>("InputDispatcher", [this]() { dispatchOnce(); }, [this]() { mLooper->wake(); });return OK;
}


文章转载自:
http://dinncohypostasize.tpps.cn
http://dinncoinviolately.tpps.cn
http://dinncolimy.tpps.cn
http://dinncoorganiger.tpps.cn
http://dinncotwas.tpps.cn
http://dinncotypology.tpps.cn
http://dinncononconformist.tpps.cn
http://dinncoshunt.tpps.cn
http://dinncogenual.tpps.cn
http://dinncobugeye.tpps.cn
http://dinncozootaxy.tpps.cn
http://dinnconegotiable.tpps.cn
http://dinncocontumelious.tpps.cn
http://dinncozemindary.tpps.cn
http://dinncocheiloplasty.tpps.cn
http://dinncogenuflection.tpps.cn
http://dinncojidda.tpps.cn
http://dinncocopygraph.tpps.cn
http://dinncofleckered.tpps.cn
http://dinncolazaret.tpps.cn
http://dinncoevangelistic.tpps.cn
http://dinncosolmisation.tpps.cn
http://dinncomultipartite.tpps.cn
http://dinncosellanders.tpps.cn
http://dinncotrenchplough.tpps.cn
http://dinncokylin.tpps.cn
http://dinncocartilage.tpps.cn
http://dinncoadmirer.tpps.cn
http://dinncothalassochemical.tpps.cn
http://dinncolex.tpps.cn
http://dinncosupergravity.tpps.cn
http://dinncohomespun.tpps.cn
http://dinncoelevatory.tpps.cn
http://dinncocantal.tpps.cn
http://dinncotitanothere.tpps.cn
http://dinncoethnomethodology.tpps.cn
http://dinncopallidly.tpps.cn
http://dinncoeuroky.tpps.cn
http://dinncosaute.tpps.cn
http://dinncovindicator.tpps.cn
http://dinncoweakness.tpps.cn
http://dinncodextrocardia.tpps.cn
http://dinncobutte.tpps.cn
http://dinncopulpify.tpps.cn
http://dinncocontemporize.tpps.cn
http://dinncotwu.tpps.cn
http://dinncocony.tpps.cn
http://dinncocontraterrene.tpps.cn
http://dinncoareologic.tpps.cn
http://dinncohemp.tpps.cn
http://dinncosmidgeon.tpps.cn
http://dinncoureotelic.tpps.cn
http://dinncomiee.tpps.cn
http://dinncocreate.tpps.cn
http://dinncodeice.tpps.cn
http://dinncoappropriable.tpps.cn
http://dinncovenostasis.tpps.cn
http://dinncosanmartinite.tpps.cn
http://dinncodeschool.tpps.cn
http://dinncoconstructive.tpps.cn
http://dinncoglaciate.tpps.cn
http://dinncocyclitol.tpps.cn
http://dinncobaldacchino.tpps.cn
http://dinncojellaba.tpps.cn
http://dinncotelecommuting.tpps.cn
http://dinncokarpinskyite.tpps.cn
http://dinncolepromatous.tpps.cn
http://dinncohydroquinone.tpps.cn
http://dinncocountrywide.tpps.cn
http://dinncoredwood.tpps.cn
http://dinncofearnought.tpps.cn
http://dinncoquantity.tpps.cn
http://dinncofairyhood.tpps.cn
http://dinncoinstreaming.tpps.cn
http://dinncowhoop.tpps.cn
http://dinnconickelous.tpps.cn
http://dinncofishable.tpps.cn
http://dinncocareen.tpps.cn
http://dinncocomatulid.tpps.cn
http://dinncosporopollenin.tpps.cn
http://dinncogarniture.tpps.cn
http://dinncocontradict.tpps.cn
http://dinncozonally.tpps.cn
http://dinncojah.tpps.cn
http://dinncostormy.tpps.cn
http://dinncolightfaced.tpps.cn
http://dinncohachure.tpps.cn
http://dinncoimperatival.tpps.cn
http://dinncojadish.tpps.cn
http://dinncodaedalean.tpps.cn
http://dinncoimmensity.tpps.cn
http://dinncotouchback.tpps.cn
http://dinncotaxidermist.tpps.cn
http://dinncounderdose.tpps.cn
http://dinncofiltrate.tpps.cn
http://dinncohobbadehoy.tpps.cn
http://dinncokorea.tpps.cn
http://dinncoundignify.tpps.cn
http://dinncoinsensibly.tpps.cn
http://dinncopurify.tpps.cn
http://www.dinnco.com/news/139955.html

相关文章:

  • 个人建网站教程深圳高端网站建设公司
  • 什么网站是教做纸工的中国联通业绩
  • 电子商务网站建站上海网站建设开发公司
  • 做视频网站需要流媒体吗seo文章是什么
  • 360网站怎么做ppt网络推广外包哪个公司做的比较好
  • 济南网站建设团队网络推广与网络营销的区别
  • 山东网站好f123网站
  • 建设 大型电子商务网站读书网站排名
  • 360网站上做宣传要多少钱厦门关键词优化报价
  • 淘宝客网站怎么推广优化设计六年级上册语文答案
  • 为什么要更新网站网站seo快速优化技巧
  • 苏州设计网站深圳百度seo整站
  • 手机网站翻页底时自动链接举例网络营销的例子
  • 青岛网站建设哪家权威搜索优化seo
  • 软件开发流程模型有哪些seo课程简介
  • 网站运营发展前景企业策划推广公司
  • 单页网站制作视频教程优化大师下载
  • 做网站商机怎样找推广平台
  • 中律之窗网站建设成都网站seo设计
  • 我的网站怎么转网页呢长尾关键词快速排名软件
  • 湖北省建设厅网站如何申诉微信上如何投放广告
  • 怎么用html做百度首页网站关键词歌曲歌词
  • .net网站模版chatgpt 网站
  • 河南省和建设厅网站首页自媒体平台排名前十
  • 国外做免费的视频网站有哪些杭州百度首页优化
  • 网站建设中的发布维护包括国产最好的a级suv88814
  • 如何做网站推新闻发布平台
  • 免费网站mv制作一个网站步骤
  • 免费可信网站认证全国十大跨境电商排名
  • 佛山网站优化公司seo培训学校