Re: [android-porting] Re: Adding new module to android framework

359 views
Skip to first unread message

Shivaprasad Imdapur

unread,
May 25, 2013, 4:59:49 AM5/25/13
to shridutt kothari, android...@googlegroups.com
Hi Shridutt,

   Thanks a lot for your continues support and help.. I tried with above mechanism which you mentioned in your blog.. Still I have problems.

 1. In my Manager class there is a method which returns int data type like below

      public int dataFromService() {

              if (mService == null) {
                    Log.w(TAG, "Failed to get data; no Biometric service.");
                   return 0;
             }
             try {
              mValue =  mService.intFromService();
             } catch (RemoteException e) {
          }
       return mValue;
    }

   The above function I am calling in my app like below,

   DemoProxy dm= (DemoProxy) getApplicatioContext().getSystemService(Context.DEMO_SERVICE);

   int value = dm.dataFromService();

   But it is giving me a nullpointerexception.



I have one doubt  in your code (Manager class)..

   public IDemoService getDemoService(){
            mDemoService;
     }

  it should be return mDemoService. Is  I am correct ?

Thanks
Shiv



On Fri, May 24, 2013 at 9:45 PM, shridutt kothari <shridut...@gmail.com> wrote:
Hi Shiv,


let me know if you still face any issues.

Thanks,
Shridutt Kothari
Impetus Infotech 


On Friday, May 17, 2013 7:06:39 PM UTC+5:30, Prasad wrote:
Hi Shridutt,

    1. As you said in mail I created Manager class in below path

         framework/base/core/java/android/os/my_manager.java/

    2. I created .aidl in same above path and I registered .aidl file in Framework/base/Android.mk

    3. I created Service class in this path 
         frameworl/base/services/java/com/android/server/your_custom_service and registerd in SystemService.java

    4.  I register my manager like below in the class /frameworks/base/core/java/android/app/ContextImpl.java

           registerService("service_name", new ServiceFetcher() {
        public Object createService(ContextImpl ctx) {
             return new your_service_manager(); 
              }});

   5.   Now inside /frameworks/base/core/java/android/content/Context.java, add following lines
                  public static final String DEMO_SERVICE = "service_name";

  6. After using all above steps I am using   getSystemService(Context.DEMO_SERVICE ) to access API's in App layer but  I am getting below error..


   ava.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.biometricclient/com.example.biometricclient.BioClient}: java.lang.Runtimd
E/AndroidRuntime( 3020):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
E/AndroidRuntime( 3020):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
E/AndroidRuntime( 3020):        at android.app.ActivityThread.access$600(ActivityThread.java:123)
E/AndroidRuntime( 3020):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
E/AndroidRuntime( 3020):        at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 3020):        at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 3020):        at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime( 3020):        at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3020):        at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 3020):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime( 3020):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)               
E/AndroidRuntime( 3020):        at dalvik.system.NativeStart.main(Native Method)                              
E/AndroidRuntime( 3020): Caused by: java.lang.RuntimeException: Not implemented                               
E/AndroidRuntime( 3020):        at android.app.ContextImpl$ServiceFetcher.createService(ContextImpl.java:213) 
E/AndroidRuntime( 3020):        at android.app.ContextImpl$ServiceFetcher.getService(ContextImpl.java:202)
E/AndroidRuntime( 3020):        at android.app.ContextImpl.getSystemService(ContextImpl.java:1193)
E/AndroidRuntime( 3020):        at android.view.ContextThemeWrapper.getSystemService(ContextThemeWrapper.java:79)
E/AndroidRuntime( 3020):        at android.app.Activity.getSystemService(Activity.java:3999)
E/AndroidRuntime( 3020):        at com.example.biometricclient.BioClient.onCreate(BioClient.java:58)
E/AndroidRuntime( 3020):        at android.app.Activity.performCreate(Activity.java:4465)
E/AndroidRuntime( 3020):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
E/AndroidRuntime( 3020):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
E/AndroidRuntime( 3020):        ... 11 more

  How to solve this one..

Thanks
Shiv
   

On Monday, 13 May 2013 19:42:04 UTC+5:30, shridutt kothari wrote:
Hi Prasad,

Texas has explained this in very good way here @ http://processors.wiki.ti.com/index.php/Android-Adding_SystemService.
I have tested the procedure.

·         http://tools.android.com/build


Let me know if any further jelp required.
Thanks,
Shridutt kothari
On Friday, May 10, 2013 12:16:10 PM UTC+5:30, Prasad wrote:
Hi,

   How to add new module to a android framework. i.e By adding a new module I want to access API for application layer using getSystemService() method. How to do this one ? Is there any document or procedure to add new module to a framework.

Thanks

--
--
unsubscribe: android-porti...@googlegroups.com
website: http://groups.google.com/group/android-porting
 
---
You received this message because you are subscribed to the Google Groups "android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-porti...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Shivaprasad Imdapur

unread,
May 27, 2013, 9:30:59 AM5/27/13
to shridutt kothari, android...@googlegroups.com
Hi Shridutta,

     Very nice blog. It works for me . Thanks a lot ::)

Thanks
Shiv
Reply all
Reply to author
Forward
0 new messages