OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.services.device; |
| 6 |
| 7 import android.content.Context; |
| 8 |
| 9 import org.chromium.base.annotations.CalledByNative; |
| 10 import org.chromium.base.annotations.JNINamespace; |
| 11 import org.chromium.device.BatteryMonitor; |
| 12 import org.chromium.device.battery.BatteryMonitorFactory; |
| 13 import org.chromium.mojo.system.impl.CoreImpl; |
| 14 import org.chromium.services.service_manager.InterfaceRegistry; |
| 15 |
| 16 @JNINamespace("device") |
| 17 class InterfaceRegistrar { |
| 18 @CalledByNative |
| 19 static void createInterfaceRegistryForContext(int nativeHandle, Context appl
icationContext) { |
| 20 // Note: The bindings code manages the lifetime of this object, so it |
| 21 // is not necessary to hold on to a reference to it explicitly. |
| 22 InterfaceRegistry registry = InterfaceRegistry.create( |
| 23 CoreImpl.getInstance().acquireNativeHandle(nativeHandle).toMessa
gePipeHandle()); |
| 24 registry.addInterface( |
| 25 BatteryMonitor.MANAGER, new BatteryMonitorFactory(applicationCon
text)); |
| 26 } |
| 27 } |
OLD | NEW |