// Copyright (c) 2013 Intel Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.xwalk.runtime;

import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.ServiceConnection;

/**
 * MixContext provides ApplicationContext for the contextImpl object
 * created by Context.CreatePackageContext().
 *
 * For cross package usage, the library part need the possibility to
 * get both the application's context and the library itself's context.
 *
 */
public class MixContext extends ContextWrapper {
    private Context mAppCtx;

    public MixContext(Context base, Context app) {
        super(base);
        mAppCtx = app.getApplicationContext();
    }

    @Override
    public Context getApplicationContext() {
        return mAppCtx;
    }

    @Override
    public boolean bindService(Intent in, ServiceConnection conn, int flags) {
        return mAppCtx.bindService(in, conn, flags);
    }

    @Override
    public void unbindService(ServiceConnection conn) {
        mAppCtx.unbindService(conn);
    }
}

@@ -674,18 +674,23 @@
 ntext mA
-pp
+ctivity
 Ctx;%0A%0A  
@@ -732,18 +732,23 @@
 ontext a
-pp
+ctivity
 ) %7B%0A    
@@ -778,43 +778,29 @@
   mA
-ppCtx = app.getApplicationContext()
+ctivityCtx = activity
 ;%0A  
@@ -880,21 +880,50 @@
 eturn mA
-ppCtx
+ctivityCtx.getApplicationContext()
 ;%0A    %7D%0A
@@ -1031,23 +1031,39 @@
  return 
-mAppCtx
+getApplicationContext()
 .bindSer
@@ -1174,34 +1174,173 @@
     
-mAppCtx.unbindService(conn
+getApplicationContext().unbindService(conn);%0A    %7D%0A%0A    @Override%0A    public Object getSystemService(String name) %7B%0A        return mActivityCtx.getSystemService(name
 );%0A 

Fix the context issue to let content create windows