include/hiker/appmgr.h

Go to the documentation of this file.
00001 /********************************************************************
00002  *
00003  * Copyright (c) 1999-2008 ACCESS CO., LTD. All rights reserved.
00004  * Copyright 2006, 2007, ACCESS Systems Americas, Inc. All rights reserved.
00005  *
00006  * Version: MPL 1.1/LGPL 2.1
00007  *
00008  * The contents of this file are subject to the Mozilla Public License Version
00009  * 1.1 (the "License"); you may not use this file except in compliance with
00010  * the License. You may obtain a copy of the License at
00011  * http://www.mozilla.org/MPL/
00012  *
00013  * Software distributed under the License is distributed on an "AS IS" basis,
00014  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00015  * for the specific language governing rights and limitations under the
00016  * License.
00017  *
00018  * The Original Code is hikerproject.org code.
00019  *
00020  * The Initial Developer of the Original Code is ACCESS Systems Americas, Inc.
00021  *               Portions created by the Initial Developer are
00022  *      Copyright 2006-2007 the Initial Developer. All Rights Reserved.
00023  *
00024  * Contributor(s):
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
00028  * case the provisions of the LGPL are applicable instead of those above.
00029  * If you wish to allow use of your version of this file only under the terms
00030  * of the LGPL, and not to allow others to use your version of this file under
00031  * the terms of the MPL, indicate your decision by deleting the provisions
00032  * above and replace them with the notice and other provisions required by
00033  * the LGPL. If you do not delete the provisions above, a recipient may use
00034  * your version of this file under the terms of either the MPL or the LGPL.
00035  * You may obtain a copy of the LGPL at http://www.gnu.org/licenses/lgpl.txt.
00036  *
00037  ********************************************************************/
00046 #ifndef __ALP_APPLICATION_MGR_H_
00047 #define __ALP_APPLICATION_MGR_H_
00048 
00049 #include <sys/types.h>
00050 #include <glib.h>
00051 #include <hiker/ipc.h>
00052 #include <hiker/types.h>
00053 #include <hiker/config_defines.h>
00054 
00055 #include <hiker/traces.h>
00056 
00057 
00058 #ifdef __cplusplus
00059 extern "C" {
00060 #endif
00061 
00067 
00068 int alp_main(int argc, char* argv[]);
00069 
00070 typedef void (*AlpAppLaunchCompletionProc) (alp_status_t status, pid_t pid, gpointer cbData);
00071 typedef void (*AlpRelaunchHandler) (int argc, char* argv[], gpointer cbData);
00072 typedef void (*AlpExitHandler) (gpointer cbData);
00073 typedef uint32_t AlpWatcherRef;
00074 
00075 
00076 /*
00077         App Server error codes
00078 */
00079 #define ALP_STATUS_APP_PARAM            ((alp_status_t)ALP_CLASS_APPSERVER | 0x00010000)
00080 #define ALP_STATUS_APP_IPC              ((alp_status_t)ALP_CLASS_APPSERVER | 0x00020000)
00081 #define ALP_STATUS_APP_NOT_FOUND        ((alp_status_t)ALP_CLASS_APPSERVER | 0x00030000)        // Something not found in some list.
00082 #define ALP_STATUS_APP_NO_CONTEXT       ((alp_status_t)ALP_CLASS_APPSERVER | 0x00040000)        // No AlpAppContext.
00083 #define ALP_STATUS_APP_NO_LAUNCHPAD ((alp_status_t)ALP_CLASS_APPSERVER | 0x00050000)    // missing launchpad
00084 #define ALP_STATUS_APP_MSG              ((alp_status_t)ALP_CLASS_APPSERVER | 0x00060000)        // malformed message
00085 #define ALP_STATUS_APP_RUNNING  ((alp_status_t)ALP_CLASS_APPSERVER | 0x00070000)        // app is already running (can't debug running apps)
00086 #define ALP_STATUS_APP_MEM              ((alp_status_t)ALP_CLASS_APPSERVER | 0x00080000)        // Memory allocation failed.
00087 #define ALP_STATUS_APP_LAUNCHPAD        ((alp_status_t)ALP_CLASS_APPSERVER | 0x00090000)        // Unable to launch. Probably a missing or malformed app.
00088 #define ALP_STATUS_APP_BLOCKED  ((alp_status_t)ALP_CLASS_APPSERVER | 0x000A0000)        // The app is currently blocked from launching.
00089 #define ALP_STATUS_APP_NOT_READY        ((alp_status_t)ALP_CLASS_APPSERVER | 0x000B0000)        // The system is not yet ready to launch primary apps.
00090 
00091 
00092 // String constants for standard application properties (from the package manifest file)
00093 
00094 #define ALP_APP_PROP_NAME               "name"
00095 #define ALP_APP_PROP_VENDOR             "vendor"
00096 #define ALP_APP_PROP_BACKGROUNDING      "backgrounding"
00097 #define ALP_APP_PROP_HIDDEN             "hidden"                // Boolean.  "true" to hide app from users.
00098 #define ALP_APP_PROP_JUMP_LIST  "jump-list"     // Default is to display primary launched apps only.  Set to "never" or "always" to override.
00099 #define ALP_APP_PROP_ENABLE_THEME       "enable-theme"  // Boolean.  "true" to enable our theming engine.  Defaults to TRUE eventually, but for development ease, it will default to FALSE until the theming is mature.
00100 #define ALP_APP_PROP_TRANSIENT  "transient"     // Boolean. "true" to be always retired when the primary app changes, regardless of whether or not the apps is launched with ALP_APP_TRANSIENT.
00101 #define ALP_APP_PROP_UPDATE                     "update-menu"           // Command line to execute to update an application.  If present, the "Update" item is shown in Launcher "Applications" menu
00102 #define ALP_APP_PROP_SETTINGS           "settings-menu"         // Command line to execute to edit an application's settings.  If present, the "Settings" item is shown in Launcher "Applications" menu
00103 #define ALP_APP_PROP_DELETE                     "delete-menu"           // Command line to execute to delete an application.  If not present, application is deleted using Bundle Mgr
00104 #define ALP_APP_PROP_PREVENT_DELETE     "prevent-delete"        // Boolean. "true" if application cannot be deleted
00105 #define ALP_APP_PROP_PREVENT_COPY       "prevent-copy"          // Boolean. "true" if application cannot be copied
00106 #define ALP_APP_PROP_ICON                       "icon"                          // Path to an icon resource or an ALP stock icon ID
00107 #define ALP_APP_PROP_VERSION            "version"                       // Version string for application
00108 
00109 
00110 
00111 // constants for standard application property values (from the package manifest file)
00112 
00113 
00114 // Values for ALP_APP_PROP_BACKGROUNDING
00117 #define ALP_APP_PROP_BG_UNSUPPORTED "unsupported"
00118 
00122 #define ALP_APP_PROP_BG_SUPPORTED "supported"
00123 
00127 #define ALP_APP_PROP_BG_PREFERRED "preferred"
00128 
00133 #define ALP_APP_PROP_BG_REQUIRED "required"
00134 
00135 
00136 
00137 
00139 typedef enum
00140 {
00141         ALP_APP_BACKGROUND_UNSUPPORTED = 1,
00142         ALP_APP_BACKGROUND_SUPPORTED,
00143         ALP_APP_BACKGROUND_PREFERRED,
00144         ALP_APP_BACKGROUND_REQUIRED,
00145 
00146         ALP_APP_BACKGROUND_DEFAULT = ALP_APP_BACKGROUND_UNSUPPORTED
00147 } AlpAppBackgroundingType;
00148 
00149 typedef enum
00150 {
00151         ALP_APP_MEMORY_STATE_UNKNOWN = 0,
00152         ALP_APP_MEMORY_STATE_LOW = 1,
00153         ALP_APP_MEMORY_STATE_LOW_RECOVER = 2,
00154         ALP_APP_MEMORY_STATE_CRITICAL = 3,
00155         ALP_APP_MEMORY_STATE_CRITICAL_RECOVER = 4,
00156 } AlpAppMemoryState;
00157 
00159 
00185 alp_status_t alp_app_launch(const char *bundleID, int argc, char *const argv[], pid_t *outPID);
00186 
00188 
00201 alp_status_t alp_app_launch_async(const char *bundleID, int argc, char *const argv[], AlpAppLaunchCompletionProc completionProc, gpointer cbData);
00202 
00203 
00205 
00218 alp_status_t alp_app_retire(const char *bundleID);
00219 
00220 
00222 
00231 alp_status_t alp_app_retire_transients(void);
00232 
00233 
00235 
00258 alp_status_t alp_app_exit(const char *bundleID);
00259 
00260 
00262 
00274 alp_status_t alp_app_watcher_add(const char *bundleID, AlpWatcherRef *outWatcherRef, gboolean *outAppRan);
00275 
00277 
00286 alp_status_t alp_app_watcher_check(AlpWatcherRef watcherRef, gboolean *outAppRan);
00287 
00289 
00303 alp_status_t alp_app_watcher_block(AlpWatcherRef watcherRef, gboolean blockLaunch);
00304 
00306 
00316 alp_status_t alp_app_watcher_remove(AlpWatcherRef watcherRef, gboolean *outAppRan);
00317 
00318 
00320 
00324 gboolean alp_app_is_primary(void);
00325 
00326 
00328 
00338 alp_status_t alp_app_current(char **outBundleID);
00339 
00340 
00342 
00355 alp_status_t alp_app_set_backgrounding(AlpAppBackgroundingType newBackgrounding);
00356 
00358 
00366 alp_status_t alp_app_get_backgrounding(AlpAppBackgroundingType *outBackgrounding);
00367 
00369 
00383 alp_status_t alp_app_set_relaunch_handler(AlpRelaunchHandler procP, gpointer cbData);
00384 
00385 
00387 
00400 alp_status_t alp_app_add_exit_handler(AlpExitHandler procP, gpointer cbData);
00401 
00403 
00411 alp_status_t alp_app_remove_exit_handler(AlpExitHandler procP);
00412 
00414 
00425 alp_status_t alp_app_remove_exit_handler_with_data(AlpExitHandler procP, gpointer cbData);
00426 
00427 
00429 
00436 alp_status_t alp_app_reset_system(void);
00437 
00438 
00440 
00444 gboolean alp_gremlins_is_running(void);
00445 
00446 
00447 
00448 // Miscellaneous Constants:
00449 
00450 // maximum size in bytes of app name/"id", including null terminator.  DOLATER: Document as policy somewhere.
00451 #define PKG_ID_MAX_SIZE 256
00452 
00453 // ALP settings keys:
00454 #define ALP_APP_SETTING_APPMGR_DIR "/alp/appmgr"
00455 #define ALP_APP_SETTING_DEFAULT_PRIMARY "/alp/appmgr/default-primary"
00456 #define ALP_APP_SETTING_OTHER_PRIMARY "/alp/appmgr/other-primary"
00457 #define ALP_APP_SETTING_LONG_PRESS_APP "/alp/appmgr/long-press-app"
00458 //appserver takes to this app when home key is pressed. If this is not set then it will take to default-primary.
00459 #define ALP_APP_SETTING_HOME_KEY_APP "/alp/appmgr/home-key-app"
00460 //appserver takes to this app when end key is pressed. If this is not set appserver remains in the current app. 
00461 #define ALP_APP_SETTING_END_KEY_APP "/alp/appmgr/end-key-app"
00462 
00463 #define ALP_APP_SETTING_DISABLE_PRIMARY "/alp/appmgr/disable-primary-launches"
00464 #define ALP_APP_SETTING_DEFAULT_ORIENTATION "/alp/appmgr/default-orientation" 
00465 
00466 #define ALP_NOTIFY_EVENT_APP_MEMORY_LOW "/alp/appmgr/memory-low"
00467 #define ALP_NOTIFY_EVENT_APP_MEMORY_LOW_RECOVER "/alp/appmgr/memory-low-recover"
00468 #define ALP_NOTIFY_EVENT_APP_MEMORY_CRITICAL "/alp/appmgr/memory-critical"
00469 #define ALP_NOTIFY_EVENT_APP_MEMORY_CRITICAL_RECOVER "/alp/appmgr/memory-critical-recover"
00470 
00471 
00472 // Standard launch arguments
00474 
00478 #define ALP_APP_PRIMARY "--alp-primary"
00479 
00481 
00488 #define ALP_APP_BACKGROUNDED    "--alp-backgrounded"
00489 
00491 
00495 #define ALP_APP_DISPLAY         "--alp-display"
00496 
00498 
00502 #define ALP_APP_FIND            "--alp-find"
00503 
00505 
00510 #define ALP_APP_FIND_CANCEL "--alp-find-cancel"
00511 
00513 
00518 #define ALP_APP_DEBUG           "--alp-debug"
00519 
00521 
00524 #define ALP_APP_NOTIFY          "--alp-notify"
00525 
00527 
00530 #define ALP_APP_EXCHANGE                "--alp-exchange"
00531 
00533 
00536 #define ALP_APP_ALARM           "--alp-alarm"
00537 
00539 
00550 #define ALP_APP_ALARM_REASON    "--alp-alarm-reason"
00551 
00553 
00564 #define ALP_APP_TRANSIENT       "--alp-transient"
00565 
00567 
00573 #define ALP_APP_CLOSE_SESSION           "--alp-close-session"
00574 
00576 #define ALP_APP_ALLOW_EARLY       "--alp-allow-early"
00577 
00578 
00580 
00608 #ifdef __cplusplus
00609 }       // extern "C"
00610 #endif
00611 
00612 #endif // __ALP_APPLICATION_MGR_H_
00613 
00614 

Generated on Wed Jul 30 07:06:39 2008 by Doxygen 1.4.6 for ALP SDK + Hiker Documentation

Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.