1 /* 2 * Copyright (C) 2016 Google Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 * use this file except in compliance with the License. You may obtain a copy of 6 * the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 * License for the specific language governing permissions and limitations under 14 * the License. 15 */ 16 17 package com.googlecode.android_scripting.activity; 18 19 import android.app.Activity; 20 import android.content.Intent; 21 import android.os.Bundle; 22 import android.os.SystemProperties; 23 24 import android.util.Log; 25 26 import com.googlecode.android_scripting.Constants; 27 28 public class ScriptingLayerServiceLauncher extends Activity { 29 30 private static final int DEBUGGABLE_BUILD = 1; 31 32 private static final String LOG_TAG = "sl4a"; 33 @Override onCreate(Bundle savedInstanceState)34 protected void onCreate(Bundle savedInstanceState) { 35 super.onCreate(savedInstanceState); 36 // Forward the intent that launched us to start the service. 37 38 if(SystemProperties.getInt("ro.debuggable", 0) == DEBUGGABLE_BUILD) { 39 Intent intent = getIntent(); 40 intent.setComponent(Constants.SL4A_SERVICE_COMPONENT_NAME); 41 startService(intent); 42 finish(); 43 } 44 else { 45 Log.e(LOG_TAG, "ERROR: Cannot to start SL4A on non-debuggable build!"); 46 } 47 } 48 } 49