OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.midi; | 5 package org.chromium.midi; |
6 | 6 |
7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.media.midi.MidiDevice; | 9 import android.media.midi.MidiDevice; |
10 import android.media.midi.MidiDeviceInfo; | 10 import android.media.midi.MidiDeviceInfo; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 @CalledByNative | 60 @CalledByNative |
61 static MidiManagerAndroid create(Context context, long nativeManagerPointer)
{ | 61 static MidiManagerAndroid create(Context context, long nativeManagerPointer)
{ |
62 return new MidiManagerAndroid(context, nativeManagerPointer); | 62 return new MidiManagerAndroid(context, nativeManagerPointer); |
63 } | 63 } |
64 | 64 |
65 /** | 65 /** |
66 * @param context | 66 * @param context |
67 * @param nativeManagerPointer The native pointer to a midi::MidiManagerAndr
oid object. | 67 * @param nativeManagerPointer The native pointer to a midi::MidiManagerAndr
oid object. |
68 */ | 68 */ |
69 private MidiManagerAndroid(Context context, long nativeManagerPointer) { | 69 private MidiManagerAndroid(Context context, long nativeManagerPointer) { |
70 // TODO(crbug.com/665157) | 70 assert ThreadUtils.runningOnUiThread(); |
71 // assert ThreadUtils.runningOnUiThread(); | |
72 | 71 |
73 mManager = (MidiManager) context.getSystemService(Context.MIDI_SERVICE); | 72 mManager = (MidiManager) context.getSystemService(Context.MIDI_SERVICE); |
74 mHandler = new Handler(ThreadUtils.getUiThreadLooper()); | 73 mHandler = new Handler(ThreadUtils.getUiThreadLooper()); |
75 mNativeManagerPointer = nativeManagerPointer; | 74 mNativeManagerPointer = nativeManagerPointer; |
76 } | 75 } |
77 | 76 |
78 /** | 77 /** |
79 * Initializes this object. | 78 * Initializes this object. |
80 * This function must be called right after creation. | 79 * This function must be called right after creation. |
81 */ | 80 */ |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 mIsInitialized = true; | 165 mIsInitialized = true; |
167 } | 166 } |
168 } | 167 } |
169 | 168 |
170 static native void nativeOnInitialized( | 169 static native void nativeOnInitialized( |
171 long nativeMidiManagerAndroid, MidiDeviceAndroid[] devices); | 170 long nativeMidiManagerAndroid, MidiDeviceAndroid[] devices); |
172 static native void nativeOnInitializationFailed(long nativeMidiManagerAndroi
d); | 171 static native void nativeOnInitializationFailed(long nativeMidiManagerAndroi
d); |
173 static native void nativeOnAttached(long nativeMidiManagerAndroid, MidiDevic
eAndroid device); | 172 static native void nativeOnAttached(long nativeMidiManagerAndroid, MidiDevic
eAndroid device); |
174 static native void nativeOnDetached(long nativeMidiManagerAndroid, MidiDevic
eAndroid device); | 173 static native void nativeOnDetached(long nativeMidiManagerAndroid, MidiDevic
eAndroid device); |
175 } | 174 } |
OLD | NEW |