// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "minibind.h" #include "channel.h" #include "command.h" #include "common.h" #include "parcel.h" namespace minibind { namespace { Channel* GetServiceManager() { static Channel* service_manager = nullptr; if (!service_manager) { service_manager = new Channel(0); Parcel in, out; service_manager->Call(Channel::PING_TRANSACTION, in, &out); service_manager->reader()->Print(); } return service_manager; } } // namespace Channel* LookupService(const std::string& name) { Parcel data; data.WriteInterfaceToken("android.os.IServiceManager"); data.WriteUTF8(name); Parcel reply; Channel* channel = GetServiceManager(); channel->Call(2 /*CHECK_SERVICE_TRANSACTION*/, data, &reply); channel->reader()->Print(); uint32_t cmd = 0; CHECK(channel->reader()->ReadUInt32(&cmd)); ALOG("Got command: %x (dec %d %u)", cmd, cmd, cmd); CHECK(channel->reader()->ReadUInt32(&cmd)); ALOG("Got command: %x (dec %d %u)", cmd, cmd, cmd); } } // namespace minibind