~phablet-team/platform-api/mir-packaging

« back to all changes in this revision

Viewing changes to android/hybris/application_manager.cpp

  • Committer: Tarmac
  • Author(s): Ricardo Mendoza
  • Date: 2013-06-11 07:26:38 UTC
  • mfrom: (61.2.2 working-trunk)
  • Revision ID: tarmac-20130611072638-u7qim1u78yeovkbd
Allow remote App Manager to take care of signalling processes.

Approved by Ricardo Salveti, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
namespace android
24
24
{
25
25
IMPLEMENT_META_INTERFACE(ClipboardService, "UbuntuClipboardService");
 
26
IMPLEMENT_META_INTERFACE(AMTaskController, "UbuntuApplicationManagerTaskController");
26
27
IMPLEMENT_META_INTERFACE(ApplicationManagerObserver, "UbuntuApplicationManagerObserver");
27
28
IMPLEMENT_META_INTERFACE(ApplicationManagerSession, "UbuntuApplicationManagerSession");
28
29
IMPLEMENT_META_INTERFACE(ApplicationManager, "UbuntuApplicationManager");
263
264
        android::IBinder::FLAG_ONEWAY);
264
265
}
265
266
 
 
267
status_t BnAMTaskController::onTransact(uint32_t code,
 
268
        const Parcel& data,
 
269
        Parcel* reply,
 
270
        uint32_t flags)
 
271
{
 
272
    switch(code)
 
273
    {
 
274
    case CONTINUE_TASK_COMMAND:
 
275
        {
 
276
            uint32_t pid = data.readInt32();
 
277
            continue_task(pid);
 
278
            break;
 
279
        }
 
280
    case SUSPEND_TASK_COMMAND:
 
281
        {
 
282
            int pid = data.readInt32();
 
283
            suspend_task(pid);
 
284
            break;
 
285
        }
 
286
    }
 
287
 
 
288
    return NO_ERROR;
 
289
}
 
290
 
 
291
BpAMTaskController::BpAMTaskController(const sp<IBinder>& impl)
 
292
    : BpInterface<IAMTaskController>(impl)
 
293
{
 
294
}
 
295
 
 
296
void BpAMTaskController::continue_task(uint32_t pid)
 
297
{
 
298
    Parcel in, out;
 
299
    in.writeInt32(pid);
 
300
 
 
301
    remote()->transact(
 
302
        CONTINUE_TASK_COMMAND,
 
303
        in,
 
304
        &out,
 
305
        android::IBinder::FLAG_ONEWAY);
 
306
}
 
307
 
 
308
void BpAMTaskController::suspend_task(uint32_t pid)
 
309
{
 
310
    Parcel in, out;
 
311
    in.writeInt32(pid);
 
312
 
 
313
    remote()->transact(
 
314
        SUSPEND_TASK_COMMAND,
 
315
        in,
 
316
        &out,
 
317
        android::IBinder::FLAG_ONEWAY);
 
318
}
 
319
 
266
320
status_t BnApplicationManagerObserver::onTransact(uint32_t code,
267
321
        const Parcel& data,
268
322
        Parcel* reply,
511
565
        register_an_observer(observer);
512
566
        break;
513
567
    }
 
568
    case REGISTER_TASK_CONTROLLER_COMMAND:
 
569
    {
 
570
        sp<IBinder> binder = data.readStrongBinder();
 
571
        sp<BpAMTaskController> controller(new BpAMTaskController(binder));
 
572
        register_task_controller(controller);
 
573
        break;
 
574
    }
514
575
    case REQUEST_UPDATE_FOR_SESSION_COMMAND:
515
576
    {
516
577
        sp<IBinder> binder = data.readStrongBinder();
681
742
                       &out);
682
743
}
683
744
 
 
745
void BpApplicationManager::register_task_controller(const sp<IAMTaskController>& controller)
 
746
{
 
747
    Parcel in, out;
 
748
    in.writeStrongBinder(controller->asBinder());
 
749
 
 
750
    remote()->transact(REGISTER_TASK_CONTROLLER_COMMAND,
 
751
                       in,
 
752
                       &out);
 
753
}
 
754
 
684
755
void BpApplicationManager::register_an_observer(const sp<IApplicationManagerObserver>& observer)
685
756
{
686
757
    Parcel in, out;