javauis/mmapi_qt/baseline/javasrc.emc/com/nokia/microedition/media/ManagerImpl.java
equal
deleted
inserted
replaced
68 |
68 |
69 Finalizer registerForFinalization() |
69 Finalizer registerForFinalization() |
70 { |
70 { |
71 return new Finalizer() |
71 return new Finalizer() |
72 { |
72 { |
73 public void finalizeImpl() |
73 public void finalizeImpl() |
74 { |
74 { |
75 doFinalize(); |
75 doFinalize(); |
76 } |
76 } |
77 }; |
77 }; |
78 } |
78 } |
79 |
79 |
80 // Play tone implementation |
80 // Play tone implementation |
81 private PlayToneImpl iPlayToneImpl = new PlayToneImpl(); |
81 private PlayToneImpl iPlayToneImpl = new PlayToneImpl(); |
82 |
82 |
127 if (sManagerHandle < NativeError.KErrNone) |
127 if (sManagerHandle < NativeError.KErrNone) |
128 { |
128 { |
129 throw new OutOfMemoryError(); |
129 throw new OutOfMemoryError(); |
130 } |
130 } |
131 //Use ShutdownListener to get notification of exit and release the resource |
131 //Use ShutdownListener to get notification of exit and release the resource |
132 //MMAPI UI 3.x work |
132 //MMAPI UI 3.x work |
133 |
133 |
134 setShutdownListener(); |
134 setShutdownListener(); |
135 // support for gif animation player |
135 // support for gif animation player |
136 iPlugIns |
136 iPlugIns |
137 .addElement(new com.nokia.microedition.media.animation.AnimationPlayerFactory()); |
137 .addElement(new com.nokia.microedition.media.animation.AnimationPlayerFactory()); |
138 |
138 |
139 // ManagerImpl is also a PlugIn that getAllSupportedContentTypes, |
139 // ManagerImpl is also a PlugIn that getAllSupportedContentTypes, |
140 // getAllSupportedProtocols and createPlayer methods can be used |
140 // getAllSupportedProtocols and createPlayer methods can be used |
141 // through PlugIn interface. |
141 // through PlugIn interface. |
142 iPlugIns.addElement(this); |
142 iPlugIns.addElement(this); |
145 iPlugIns.addElement( |
145 iPlugIns.addElement( |
146 new com.nokia.microedition.media.protocol.device.tone.Protocol()); |
146 new com.nokia.microedition.media.protocol.device.tone.Protocol()); |
147 |
147 |
148 // Create foreground listener which listens the state of the midlet |
148 // Create foreground listener which listens the state of the midlet |
149 // This feature is a part of the media keys feature so it is flagged |
149 // This feature is a part of the media keys feature so it is flagged |
150 Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"before constructing ForegroundListener...."); |
150 Logger.LOG(Logger.EJavaMMAPI, Logger.EInfo,"before constructing ForegroundListener...."); |
151 iForegroundListener = new ForegroundListener(iFunctionSourceHandle); |
151 iForegroundListener = new ForegroundListener(iFunctionSourceHandle); |
152 iForegroundListener.init(); |
152 iForegroundListener.init(); |
153 } |
153 } |
154 |
154 |
155 |
155 |
156 private void setShutdownListener() |
156 private void setShutdownListener() |
157 { |
157 { |
158 // Get the insatnce of ApplicationUtils. |
158 // Get the insatnce of ApplicationUtils. |
159 ApplicationUtils appUtils = ApplicationUtils.getInstance(); |
159 ApplicationUtils appUtils = ApplicationUtils.getInstance(); |
160 |
160 |
162 appUtils.addShutdownListener(new ShutdownListener() |
162 appUtils.addShutdownListener(new ShutdownListener() |
163 { |
163 { |
164 //The method that gets called when Application is shutting down |
164 //The method that gets called when Application is shutting down |
165 public void shuttingDown() |
165 public void shuttingDown() |
166 { |
166 { |
167 |
167 |
168 doFinalize(); |
168 doFinalize(); |
169 |
169 |
170 |
170 |
171 } |
171 } |
172 }); |
172 }); |
173 |
173 |
174 } |
174 } |
175 |
175 |
176 /** |
176 /** |
177 * Returns MMA event source handle |
177 * Returns MMA event source handle |
178 */ |
178 */ |
179 public static int getEventSource() |
179 public static int getEventSource() |
211 /** |
211 /** |
212 * This will be called when ObjectExtensions is finalized. |
212 * This will be called when ObjectExtensions is finalized. |
213 */ |
213 */ |
214 synchronized final void doFinalize() |
214 synchronized final void doFinalize() |
215 { |
215 { |
216 _dispose(iFunctionSourceHandle); |
216 _dispose(iFunctionSourceHandle); |
217 iFunctionSourceHandle = 0; |
217 iFunctionSourceHandle = 0; |
218 } |
218 } |
219 |
219 |
220 /** |
220 /** |
221 * This method is called in Toolkit's destroyNotify call. |
221 * This method is called in Toolkit's destroyNotify call. |
222 * This will release convenient native resources. All native resource |
222 * This will release convenient native resources. All native resource |
223 * will be deleted in registeredFinalize() method. |
223 * will be deleted in registeredFinalize() method. |
224 */ |
224 */ |
225 synchronized final void release() |
225 synchronized final void release() |
226 { |
226 { |
227 // _release(iFunctionSourceHandle); |
227 // _release(iFunctionSourceHandle); |
228 } |
228 } |
229 |
229 |
230 /** |
230 /** |
231 * Create String array from Vector and remove String duplicates. |
231 * Create String array from Vector and remove String duplicates. |
232 * @param aVector Vector containing String objects. |
232 * @param aVector Vector containing String objects. |
432 * This method calls preparePlayer to all PlugIns. |
432 * This method calls preparePlayer to all PlugIns. |
433 */ |
433 */ |
434 private void pluginsPreparePlayer(InternalPlayer aPlayer) |
434 private void pluginsPreparePlayer(InternalPlayer aPlayer) |
435 throws MediaException |
435 throws MediaException |
436 { |
436 { |
437 |
437 |
438 |
438 |
439 // Call preparePlayer to all plugins |
439 // Call preparePlayer to all plugins |
440 Enumeration plugins = iPlugIns.elements(); |
440 Enumeration plugins = iPlugIns.elements(); |
441 while (plugins.hasMoreElements()) |
441 while (plugins.hasMoreElements()) |
442 { |
442 { |
443 ((PlugIn)plugins.nextElement()).preparePlayer(aPlayer); |
443 ((PlugIn)plugins.nextElement()).preparePlayer(aPlayer); |
634 } |
634 } |
635 |
635 |
636 |
636 |
637 |
637 |
638 // MMAPI UI 3.x req |
638 // MMAPI UI 3.x req |
639 /** |
639 /** |
640 * get midlet state |
640 * get midlet state |
641 */ |
641 */ |
642 |
642 |
643 public boolean isForground() |
643 public boolean isForground() |
644 { |
644 { |
645 return iForegroundListener.isForeground(); |
645 return iForegroundListener.isForeground(); |
646 } |
646 } |
647 |
647 |
648 private native int _createManager(int aEventSourceHandle, |
648 private native int _createManager(int aEventSourceHandle, |
649 int aMIDletSuiteID); |
649 int aMIDletSuiteID); |
650 private native int _createEventSource(); |
650 private native int _createEventSource(); |
651 private native void _dispose(int aEventSourceHandle); |
651 private native void _dispose(int aEventSourceHandle); |