Skip to content

Commit 3e906e8

Browse files
author
Michael Zanetti
committed
merge trunk
2 parents 64ab30a + 03243cb commit 3e906e8

File tree

529 files changed

+30106
-17846
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

529 files changed

+30106
-17846
lines changed

.crossbuilder/post_deploy

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
restart unity8

CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ find_package(Qt5DBus 5.4 REQUIRED)
5757
find_package(Qt5Concurrent 5.4 REQUIRED)
5858
find_package(Qt5Sql 5.4 REQUIRED)
5959

60-
pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=18)
60+
pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=22)
6161
pkg_check_modules(GEONAMES REQUIRED geonames>=0.2)
6262
pkg_check_modules(GIO REQUIRED gio-2.0>=2.32)
6363
pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32)
6464
pkg_check_modules(QMENUMODEL REQUIRED qmenumodel)
65+
pkg_check_modules(GD3 REQUIRED gnome-desktop-3.0)
6566

6667
pkg_check_modules(UBUNTUGESTURES REQUIRED UbuntuGestures)
6768

@@ -128,6 +129,7 @@ set(SHELL_APP unity8)
128129
set(DASH_APP unity8-dash)
129130
set(SCOPE_TOOL unity-scope-tool)
130131
set(INDICATORS_CLIENT_APP indicators-client)
132+
set(GREETER_APP unity8-greeter)
131133
set(MOCK_INDICATOR_SERVICE_APP unity-mock-indicator-service)
132134

133135
include_directories(

CODING

+20-59
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,17 @@ download source
1515
$ bzr branch lp:unity8 ~/unity8/trunk
1616
$ cd ~/unity8/trunk
1717

18-
install dependencies
18+
install dependencies and build Unity 8
1919
--------------------
20-
If its your first time, install build dependencies
2120

2221
$ cd ~/unity8/trunk
23-
$ ./build.sh --setup
24-
25-
this will:
26-
- install the required dependencies to build, as well as run on the desktop
27-
- it should also install unity-scope-home and unity-lens-application which
28-
are technically "recommends", not strict dependencies
22+
$ ./build.sh
2923

30-
build Unity 8
31-
-------------
24+
If its your first time, this will install the required dependencies to build and
25+
build it.
3226

33-
$ cd ~/unity8/trunk
34-
$ ./build.sh
27+
You might want to also install unity-scope-home and unity-scope-click which
28+
are technically "recommends", not strict dependencies
3529

3630
You may also rebuild with the -c for clean, which just deletes the build
3731
directory.
@@ -43,13 +37,15 @@ Running Unity 8 on your desktop
4337
run the Unity 8 shell
4438
---------------------
4539
$ cd ~/unity8/trunk
46-
$ ./run.sh
40+
$ cd builddir
4741

48-
Options can be passed to test the lock screen
49-
$ ./run.sh -p OR -k
42+
Each component of unity8 can be ran independently for development and testing
43+
For example:
44+
$ make tryShell
45+
$ make tryLauncher
46+
$ make tryLockscreen
5047

51-
-p is for pin lock, for which the default prompt answer is "1234"
52-
-k is for keylock passphrase, for which the default prompt answer is "password"
48+
Check out the tests/qmltests/ directory for a list of things that can be ran.
5349

5450
Notes
5551
-----
@@ -70,50 +66,15 @@ Notes
7066

7167
Running Unity 8 on devices
7268
==========================
73-
- Ubuntu Touch builds are currently only available in 14.04 flavour
74-
- supported hardware should match one of those listed here
75-
https://wiki.ubuntu.com/Touch/Devices#Running_fine
76-
- follow the Ubuntu Touch install instructions for your chosen device
77-
https://wiki.ubuntu.com/Touch/Install
78-
- make sure your device is connected to a network
79-
- also make sure you have your SSH key in ~/.ssh/id_rsa.pub (or install one
80-
on the device yourself)
81-
82-
$ cd ~/unity/trunk
83-
$ ./run_on_device.sh --setup
84-
this will:
85-
- install your public SSH key on the device
86-
- install the needed dependencies
8769

88-
$ ./run_on_device.sh
89-
this will:
90-
- rsync the code to the device
91-
- build on the device
92-
- replace the running shell
93-
94-
Options can be passed to test the lock screen
95-
$ ./run_on_device.sh -p OR -k
96-
97-
-p is for pin lock, for which the default prompt answer is "1234"
98-
-k is for keylock passphrase, for which the default prompt answer is "password"
99-
100-
Notes
101-
-----
102-
- using adb over TCP has some advantages, Google will be of help here
103-
- NOTE: this is not yet available for flipped images
104-
- TL;DR: `adb tcpip 5555; adb connect $your_device_ip`
105-
- you can persist the above via `adb shell setprop persist.adb.tcp.port 5555`
106-
- it's unsafe - anyone can connect to your device
107-
- with TCP the Nexus 10 doesn't drop the adb connection when locking
108-
the screen
109-
- exporting ANDROID_SERIAL=$your_device_serial or
110-
ANDROID_SERIAL=$your_device_ip:5555 will make adb not complain about
111-
multiple devices
112-
- you can export TARGET_IP=$your_device_ip TARGET_SSH_PORT=22 for run_on_device.sh
113-
to not use adb forwarding - useful if you use multiple devices
114-
- using Ninja (package ninja-build - run_on_device.sh -s installs this now)
115-
will improve build times (especially in the nothing-to-build case)
70+
Running unity8 on a device should be done using crossbuilder.
71+
Go to
72+
* https://launchpad.net/crossbuilder and
73+
* https://wiki.ubuntu.com/Touch/Crossbuilder
74+
for more details on crossbuilder.
11675

76+
unity8 will automatically restart on the phone once deployment
77+
has finished due to post-build-steps set up in this repository.
11778

11879
Coding guidelines
11980
=================

build.sh

+6-37
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ usage() {
99
echo "usage: build [OPTIONS] [BUILD_TYPE]\n" >&2
1010
echo "Script to build the shell. If BUILD_TYPE is not specified, it defaults to \"debug\".\n" >&2
1111
echo "OPTIONS:" >&2
12-
echo " -s, --setup Setup the build environment and branch Unity" >&2
1312
echo " -c, --clean Clean the build tree before building" >&2
1413
echo >&2
1514
exit 1
@@ -22,7 +21,6 @@ eval set -- "$ARGS"
2221
while [ $# -gt 0 ]
2322
do
2423
case "$1" in
25-
-s|--setup) SETUP=true;;
2624
-c|--clean) CLEAN=true;;
2725
-h|--help) usage;;
2826
--) shift;break;;
@@ -35,31 +33,6 @@ done
3533
BUILD_TYPE="debug"
3634
[ $# -eq 1 ] && BUILD_TYPE="$1"
3735

38-
install_dependencies() {
39-
sudo apt-get update || exit 4
40-
echo "Installing Unity 8 dependencies.."
41-
sudo apt-get install devscripts \
42-
equivs \
43-
gsettings-desktop-schemas \
44-
gsettings-ubuntu-schemas \
45-
pay-service \
46-
qmenumodel-qml \
47-
qml-module-qtquick-layouts \
48-
qml-module-qtquick-xmllistmodel \
49-
qml-module-ubuntu-components \
50-
qml-module-ubuntu-thumbnailer0.1 \
51-
qtdeclarative5-gsettings1.0 \
52-
qtdeclarative5-ubuntu-settings-components \
53-
qtdeclarative5-ubuntu-telephony0.1 \
54-
qtdeclarative5-unity-notifications-plugin \
55-
qml-module-ubuntu-connectivity \
56-
ubuntu-mobile-icons \
57-
ubuntu-system-settings \
58-
unity-plugin-scopes \
59-
xvfb \
60-
|| exit 5
61-
}
62-
6336
mk_build_deps() {
6437
if [ ! -f control -o $CODE_DIR/debian/control -nt control ]; then
6538
sed 's/\:native//g' $CODE_DIR/debian/control > control
@@ -85,13 +58,9 @@ else
8558
BUILD_COMMAND="make -j$NUM_JOBS"
8659
fi
8760

88-
if $SETUP; then
89-
install_dependencies
90-
else
91-
if $CLEAN; then rm -rf builddir; fi
92-
mkdir -p builddir
93-
cd builddir
94-
mk_build_deps
95-
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CODE_DIR ${GENERATOR} || exit 6
96-
${BUILD_COMMAND} || exit 7
97-
fi
61+
if $CLEAN; then rm -rf builddir; fi
62+
mkdir -p builddir
63+
cd builddir
64+
mk_build_deps
65+
cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CODE_DIR ${GENERATOR} || exit 6
66+
${BUILD_COMMAND} || exit 7

data/51-unity8-greeter.conf

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Seat:*]
2+
greeter-session=unity8-greeter

data/CMakeLists.txt

+11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
configure_file(${SHELL_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${SHELL_APP}.desktop @ONLY)
33
configure_file(${DASH_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${DASH_APP}.desktop @ONLY)
44
configure_file(${INDICATORS_CLIENT_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${INDICATORS_CLIENT_APP}.desktop @ONLY)
5+
configure_file(${GREETER_APP}.desktop.in ${CMAKE_CURRENT_BINARY_DIR}/${GREETER_APP}.desktop @ONLY)
56

67
# install desktop files
78
install(FILES
@@ -11,6 +12,16 @@ install(FILES
1112
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications
1213
)
1314

15+
install(FILES
16+
${CMAKE_CURRENT_BINARY_DIR}/${GREETER_APP}.desktop
17+
DESTINATION ${CMAKE_INSTALL_DATADIR}/lightdm/greeters
18+
)
19+
20+
install(FILES
21+
51-unity8-greeter.conf
22+
DESTINATION ${CMAKE_INSTALL_DATADIR}/lightdm/lightdm.conf.d
23+
)
24+
1425
# install dash icon
1526
install(FILES
1627
${CMAKE_CURRENT_SOURCE_DIR}/${DASH_APP}.png

data/unity8-greeter-init.conf

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
description "Unity 8 Greeter initialization"
2+
author "Michael Terry <[email protected]>"
3+
4+
start on unity8-greeter-started
5+
task
6+
emits indicator-services-start
7+
8+
script
9+
start --no-wait ofono-setup || true
10+
initctl emit --no-wait indicator-services-start || true
11+
start --no-wait maliit-server || true
12+
end script

data/unity8-greeter-wrapper

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/bin/sh
2+
# -*- Mode: sh; indent-tabs-mode: nil; tab-width: 4 -*-
3+
#
4+
# Copyright (C) 2011,2013,2016 Canonical Ltd
5+
#
6+
# This program is free software: you can redistribute it and/or modify it under
7+
# the terms of the GNU General Public License as published by the Free Software
8+
# Foundation, version 3 of the License.
9+
#
10+
# See http://www.gnu.org/copyleft/gpl.html the full text of the license.
11+
12+
# This wrapper merely ensures that init and friends live only as long as this
13+
# script does. Otherwise, it's very easy for some processes to not notice that
14+
# the session died. We could try to do this in-process, but we want to do this
15+
# cleanup even if the greeter aborts.
16+
17+
trap cleanup TERM EXIT
18+
19+
cleanup()
20+
{
21+
trap - TERM EXIT
22+
# Kill upstart and indicators
23+
if [ -n "$INIT_PID" ]; then
24+
kill "$INIT_PID"
25+
fi
26+
if [ -n "$CMD_PID" ]; then
27+
kill "$CMD_PID"
28+
fi
29+
exit 0
30+
}
31+
32+
set_greeter_var()
33+
{
34+
export "$1=$2"
35+
gdbus call --session --dest org.freedesktop.DBus --object-path /org/freedesktop/DBus --method org.freedesktop.DBus.UpdateActivationEnvironment "{'$1': '$2'}"
36+
if [ -n "$INIT_PID" ]; then
37+
initctl set-env --global "$1=$2"
38+
fi
39+
}
40+
41+
SUB_SOCKET=$XDG_RUNTIME_DIR/mir_socket
42+
rm -f $SUB_SOCKET # clear socket in case we were hard shut down
43+
44+
echo "DBUS_SESSION_BUS_ADDRESS=${DBUS_SESSION_BUS_ADDRESS}" >"$XDG_RUNTIME_DIR/dbus-session"
45+
46+
# If touch session script (which sets up grid units and mir variables) is available, use it
47+
TOUCH_WRAPPER=
48+
if [ -x /usr/bin/ubuntu-touch-session ]; then
49+
TOUCH_WRAPPER=/usr/bin/ubuntu-touch-session
50+
fi
51+
52+
# Pretend that we're in an ubuntu-touch session, so that indicator-network
53+
# will start.
54+
export DESKTOP_SESSION=ubuntu-touch
55+
56+
# We disable ofono using pulse. It causes problems with racing with the user's
57+
# pulse. We need to come up with a better long-term fix for this, because we
58+
# eventually need the greeter to play ringtones for users that aren't logged in.
59+
set_greeter_var PA_DISABLED 1
60+
61+
# Normal unity8 sessions are entirely driven by Upstart. But greeters
62+
# are special. They need access to the file descriptors that lightdm
63+
# creates for them and don't want to start all the services that a normal
64+
# session would. So it's inconvenient to live within an upstart session.
65+
# But... we still want to use Upstart for some services. So launch here.
66+
MIR_SOCKET=$SUB_SOCKET $TOUCH_WRAPPER /sbin/upstart --user --no-startup-event &
67+
INIT_PID=$!
68+
while [ ! -e "$XDG_RUNTIME_DIR/upstart/sessions/$INIT_PID.session" ]; do sleep 0.1; done
69+
. "$XDG_RUNTIME_DIR/upstart/sessions/$INIT_PID.session"
70+
export UPSTART_SESSION
71+
72+
# Connect upstart to system, but do first command in a loop to avoid any
73+
# race condition between the session file above being written and upstart being
74+
# ready to handle requests.
75+
while ! /sbin/initctl notify-dbus-address "$DBUS_SESSION_BUS_ADDRESS"; do sleep 0.1; done
76+
/sbin/initctl start notify-cgmanager
77+
78+
# Start any pre-greeter tasks if needed (like wizard)
79+
/sbin/initctl emit unity8-greeter-starting
80+
81+
# Define language here for phone if available. When phone user switches their
82+
# language, they expect that to affect the greeter too. But the user doesn't
83+
# have permission to switch system language, only their own. So we notice if
84+
# the phablet user exists and use their language if so. TODO: talk to design
85+
# about whether we should switch language on fly as users are selected (this
86+
# is very hard to do technically).
87+
#
88+
# Do this after unity8-greeter-starting, in case a customization upstart job
89+
# changes language.
90+
if [ "$(id -u phablet 2>/dev/null)" = "32011" ]; then
91+
USER_LANG=$(gdbus call --system --dest org.freedesktop.Accounts --object-path /org/freedesktop/Accounts/User32011 --method org.freedesktop.DBus.Properties.Get org.freedesktop.Accounts.User Language | cut -d\' -f2)
92+
if [ -n "$USER_LANG" ]; then
93+
set_greeter_var LANGUAGE "$USER_LANG"
94+
fi
95+
USER_LOCALE=$(gdbus call --system --dest org.freedesktop.Accounts --object-path /org/freedesktop/Accounts/User32011 --method org.freedesktop.DBus.Properties.Get org.freedesktop.Accounts.User FormatsLocale | cut -d\' -f2)
96+
if [ -n "$USER_LOCALE" ]; then
97+
set_greeter_var LANG "$USER_LOCALE"
98+
set_greeter_var LC_ALL "$USER_LOCALE"
99+
fi
100+
fi
101+
102+
# And finally actually start the greeter
103+
exec env QT_QPA_PLATFORM=ubuntumirclient MIR_SERVER_FILE=$SUB_SOCKET $TOUCH_WRAPPER $@ &
104+
CMD_PID=$!
105+
wait $CMD_PID
106+
CMD_PID=

data/unity8-greeter.desktop.in

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=Unity 8 Greeter
4+
Comment=The converged Unity shell's Greeter
5+
Exec=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity8-greeter-wrapper @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/unity8 --mode=greeter
6+
X-LightDM-Session-Type=mir
7+
X-Ubuntu-Touch=true

0 commit comments

Comments
 (0)