1 // Copyright (c) 2013 Intel Corporation. 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.
5 package org.xwalk.runtime;
7 import android.content.Context;
8 import android.content.ContextWrapper;
9 import android.content.Intent;
10 import android.content.ServiceConnection;
13 * MixedContext provides ApplicationContext for the contextImpl object
14 * created by Context.CreatePackageContext().
16 * For cross package usage, the library part need the possibility to
17 * get both the application's context and the library itself's context.
20 public class MixedContext extends ContextWrapper {
21 private Context mActivityCtx;
23 public MixedContext(Context base, Context activity) {
25 mActivityCtx = activity;
29 public Context getApplicationContext() {
30 return mActivityCtx.getApplicationContext();
34 public boolean bindService(Intent in, ServiceConnection conn, int flags) {
35 return getApplicationContext().bindService(in, conn, flags);
39 public void unbindService(ServiceConnection conn) {
40 getApplicationContext().unbindService(conn);
44 public Object getSystemService(String name) {
45 return mActivityCtx.getSystemService(name);